@ts-utilkit/utility
v0.2.0
Published
General-purpose utility functions for debouncing, throttling, color conversion, and common patterns
Downloads
123
Maintainers
Readme
@ts-utilkit/utility
utility Functions - TypeScript utility functions for utility operations.
Installation
npm install @ts-utilkit/utilityFeatures
- 🚀 TypeScript-first with complete type definitions
- ✅ Comprehensive test coverage (>95%)
- 📦 Tree-shakeable ESM and CommonJS support
- 🔒 Type-safe with strict TypeScript configuration
- 📖 Extensive JSDoc documentation
Available Functions (9)
bytesToSize- Converts bytes to human-readable size (KB, MB, GB, etc.)debounce- Creates a debounced function that delays executiondebounceAsync- Creates a debounced async function with promise handlingdelay- Pauses execution for a specified duration (Promise-based)hexToRgb- Converts hex color to RGB objectisNil- Checks if value is null or undefinedrgbToHex- Converts RGB values to hex color stringsafeJSONParse- Safely parses JSON with fallback valuethrottle- Creates a throttled function that limits execution rate
Quick Example
import { debounce, throttle, clamp, noop } from '@ts-utilkit/utility';
debounce(fn, 300); // Delay until inactivity
throttle(fn, 100); // Limit rate
clamp(5, 0, 10); // 5 (within range)
noop(); // No-op functionLicense
MIT © Mykyta Forofontov
Contributing
Contributions are welcome! Please see the main repository for contribution guidelines.
