nukes
v2.0.0
Published
Advanced enterprise-grade JavaScript utility library providing comprehensive data manipulation, performance optimization, security utilities, and development productivity tools for modern applications.
Maintainers
Readme
Nukes v2.0.0 - Enterprise-Grade JavaScript Utility Library
A comprehensive, modular utility library for modern JavaScript development, providing enterprise-grade tools for data manipulation, performance optimization, security utilities, and development productivity.
🚀 Features
- 📁 Modular Architecture - Clean separation of concerns with dedicated modules
- ⚡ Zero Dependencies - Lightweight and self-contained
- 🔧 TypeScript Ready - JSDoc annotations for excellent IDE support
- 🏢 Enterprise-Grade - Production-ready utilities for real-world applications
- 🧪 Comprehensive Testing - Extensive test coverage for all functionality
- 📚 Rich Documentation - Complete API documentation with examples
📦 Installation
npm install nukes🎯 Quick Start
const nukes = require('nukes');
// Array utilities
const unique = nukes.array.deduplicate([1, 1, 2, 3, 3]);
const chunks = nukes.array.chunk([1, 2, 3, 4, 5, 6], 2);
// Object utilities
const cloned = nukes.object.deepClone(complexObject);
const value = nukes.object.get(obj, 'user.profile.name');
// String utilities
const camelCase = nukes.string.toCamelCase('hello-world');
const truncated = nukes.string.truncate(longText, 50);
// Validation utilities
const isValid = nukes.validation.isEmail('[email protected]');
// Security utilities
const uuid = nukes.security.generateUUID();
const masked = nukes.security.maskSensitiveData('1234567890', 2);
// Async utilities
await nukes.async.delay(1000);
const result = await nukes.async.retry(unstableFunction);
// Get package info
console.log(nukes.info());📚 API Documentation
📊 Array Module (nukes.array)
Advanced array manipulation and analysis utilities.
Core Functions
deduplicate(arr)- Remove duplicate values from arraycompact(arr)- Remove falsy values from arraychunk(arr, size)- Split array into chunks of specified sizeintersect(...arrays)- Find common elements across multiple arraysgroupBy(arr, criterion)- Group array elements by key or functionflatten(arr, depth)- Flatten nested arrays to specified depthshuffle(arr)- Randomly shuffle array elements
// Examples
const numbers = [1, 1, 2, 3, 3, 4, 5];
const unique = nukes.array.deduplicate(numbers); // [1, 2, 3, 4, 5]
const data = [1, null, 2, false, 3, '', 4];
const clean = nukes.array.compact(data); // [1, 2, 3, 4]
const large = [1, 2, 3, 4, 5, 6, 7, 8];
const chunks = nukes.array.chunk(large, 3); // [[1,2,3], [4,5,6], [7,8]]🗂️ Object Module (nukes.object)
Comprehensive object manipulation utilities.
Core Functions
deepClone(obj)- Create deep copy of objectdeepMerge(...objects)- Deep merge multiple objectsget(obj, path, defaultValue)- Get nested property using dot notationset(obj, path, value)- Set nested property using dot notationpick(obj, keys)- Create object with only specified propertiesomit(obj, keys)- Create object without specified propertieshas(obj, path)- Check if nested property exists
// Examples
const original = { a: 1, b: { c: 2, d: [3, 4] } };
const cloned = nukes.object.deepClone(original);
const user = { profile: { name: 'John', email: '[email protected]' } };
const name = nukes.object.get(user, 'profile.name'); // 'John'
nukes.object.set(user, 'profile.age', 30);
// user.profile.age is now 30🔤 String Module (nukes.string)
Advanced string manipulation and formatting utilities.
Core Functions
toCamelCase(str)- Convert to camelCasetoKebabCase(str)- Convert to kebab-casetoSnakeCase(str)- Convert to snake_casetoTitleCase(str)- Convert to Title Casetruncate(str, length, suffix)- Truncate string with ellipsispad(str, length, char, direction)- Pad string to specified lengthescapeHtml(str)- Escape HTML special charactersnormalizeWhitespace(str)- Normalize whitespace in stringextractWords(str)- Extract words from string
// Examples
const text = 'hello world example';
nukes.string.toCamelCase(text); // 'helloWorldExample'
nukes.string.toKebabCase(text); // 'hello-world-example'
nukes.string.toSnakeCase(text); // 'hello_world_example'
const long = 'This is a very long text';
nukes.string.truncate(long, 15); // 'This is a ve...'✅ Validation Module (nukes.validation)
Comprehensive validation utilities for data types and formats.
Core Functions
isEmail(email)- Validate email addressisUrl(url)- Validate URLisAlpha(str)- Check if string contains only lettersisAlphaNumeric(str)- Check if string contains only letters and numbersisPhoneNumber(phone)- Validate phone numberisCreditCard(cardNumber)- Validate credit card number (Luhn algorithm)isDate(date)- Check if value is valid dateisJson(str)- Check if string is valid JSONisInRange(num, min, max)- Check if number is within rangeisStrongPassword(password, options)- Validate password strength
// Examples
nukes.validation.isEmail('[email protected]'); // true
nukes.validation.isUrl('https://example.com'); // true
nukes.validation.isStrongPassword('MyPass123!'); // true🧹 Console Module (nukes.console)
Enhanced console utilities for debugging and logging.
Core Functions
log(level, message, data)- Enhanced logging with timestamps and colorscreateTimer(label)- Create execution timertimeFunction(fn, label)- Time function executioncreateProgressBar(total, width)- Create console progress bartable(data, columns)- Display data in table formatprettyJson(data, indent)- Pretty print JSONclear(header)- Clear console with optional headergroup(label, fn)- Group console output
// Examples
nukes.console.log('info', 'Application started');
nukes.console.log('error', 'Database connection failed', error);
const timer = nukes.console.createTimer('API Call');
// ... do work ...
const elapsed = timer(); // Returns elapsed time in ms
nukes.console.table([
{ name: 'John', age: 30 },
{ name: 'Jane', age: 25 }
]);⚡ Async Module (nukes.async)
Asynchronous operation utilities and helpers.
Core Functions
delay(ms)- Create promise delayretry(fn, options)- Retry function with exponential backoffwithTimeout(fn, timeoutMs)- Execute function with timeoutbatchExecute(tasks, batchSize)- Execute promises in batchesdebounce(fn, delayMs)- Debounce function callsthrottle(fn, intervalMs)- Throttle function callspromisify(fn)- Convert callback function to promise
// Examples
await nukes.async.delay(1000); // Wait 1 second
const result = await nukes.async.retry(
() => unstableApiCall(),
{ maxAttempts: 3, baseDelay: 1000 }
);
const debouncedSave = nukes.async.debounce(saveFunction, 500);🔒 Security Module (nukes.security)
Security utilities for data protection and validation.
Core Functions
generateRandomString(length, charset)- Generate random stringgenerateUUID()- Generate UUID v4simpleHash(str)- Create simple hash (non-cryptographic)base64Encode(str)- Base64 encode stringbase64Decode(str)- Base64 decode stringsanitizeString(str, options)- Sanitize potentially dangerous stringsmaskSensitiveData(str, visibleChars, maskChar)- Mask sensitive informationisSafeString(str, allowedPattern)- Check if string contains only safe charactersgenerateSecureToken(length)- Generate secure authentication token
// Examples
const uuid = nukes.security.generateUUID();
const token = nukes.security.generateSecureToken(32);
const encoded = nukes.security.base64Encode('Hello World');
const decoded = nukes.security.base64Decode(encoded);
const masked = nukes.security.maskSensitiveData('1234567890', 2);
// '12******90'🛠 Convenience Methods
Access commonly used functions directly from the main object:
// These are shortcuts to frequently used functions
nukes.deduplicate(array); // → nukes.array.deduplicate
nukes.deepClone(object); // → nukes.object.deepClone
nukes.toCamelCase(string); // → nukes.string.toCamelCase
nukes.isEmail(email); // → nukes.validation.isEmail
nukes.delay(ms); // → nukes.async.delay
nukes.generateUUID(); // → nukes.security.generateUUID📁 Project Structure
nukes/
├── index.js # Main entry point
├── src/ # Source modules
│ ├── array.js # Array utilities
│ ├── object.js # Object utilities
│ ├── string.js # String utilities
│ ├── validation.js # Validation utilities
│ ├── console.js # Console utilities
│ ├── async.js # Async utilities
│ └── security.js # Security utilities
├── test.js # Test suite
├── package.json # Package configuration
└── README.md # This file🧪 Testing
Run the comprehensive test suite:
npm testThe test suite covers all 47+ utility functions across all modules with real-world scenarios.
📈 Performance
- Optimized Algorithms: All functions use efficient algorithms optimized for performance
- Memory Efficient: Minimal memory footprint with careful resource management
- Zero Dependencies: No external dependencies means faster installation and smaller bundle size
- Production Ready: Battle-tested utilities suitable for enterprise applications
🔧 Development
Package Information
// Get detailed package information
const info = nukes.info();
console.log(info);
// {
// name: 'nukes',
// version: '2.0.0',
// description: 'Enterprise-grade JavaScript utility library',
// modules: ['array', 'object', 'string', 'validation', 'console', 'async', 'security'],
// author: 'sureokaycool'
// }
// List all available functions
const functions = nukes.listFunctions();
console.log(functions);Requirements
- Node.js: >= 14.0.0
- Browser: Modern browsers with ES6+ support
🤝 Contributing
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
📄 License
MIT License - see LICENSE file for details.
👤 Author
sureokaycool
Built with ❤️ for the JavaScript community
🌟 Why Choose Nukes?
- 🏢 Enterprise Ready: Production-tested utilities for real-world applications
- 📦 Modular Design: Use only what you need, when you need it
- 🔧 Developer Friendly: Excellent TypeScript support and comprehensive documentation
- ⚡ Performance Focused: Optimized algorithms and zero dependencies
- 🛡️ Reliable: Extensive testing and error handling
- 📚 Well Documented: Complete API documentation with practical examples
Transform your JavaScript development workflow with powerful, production-ready utilities. Install Nukes today and experience the difference! 🚀
