A lightweight and efficient JavaScript utility library packed with commonly used helper functions like capitalize
, debounce
, deepClone
, flattenArray
, isPrime
, and more. Designed to make everyday development easier and cleaner.
- ✅ Capitalize strings
- ✅ Debounce functions
- ✅ Deep clone objects/arrays
- ✅ Flatten nested arrays
- ✅ Format dates
- ✅ Check for prime numbers
- ✅ Merge objects
- ✅ Generate random numbers in a range
- ✅ Truncate strings
- ✅ Get unique values from arrays
npm install snappy-utils
or with yarn:
yarn add snappy-utils
import {
capitalize,
debounce,
deepClone,
flattenArray,
formatDate,
isPrime,
mergeObjects,
randomInRange,
truncateString,
uniqueArray
} from 'snappy-utils';
console.log(capitalize("hello")); // "Hello"
console.log(flattenArray([1, [2, [3]]])); // [1, 2, 3]
console.log(isPrime(7)); // true
├Utils/
├── capitalize.js
├── debounce.js
├── deepClone.js
├── flattenArray.js
├── formatDate.js
├── isPrime.js
├── mergeObjects.js
├── randomInRange.js
├── truncateString.js
├── uniqueArray.js
├ index.js # Exports all functions
├ package.json
└ README.MD
Capitalize the first letter of a string.
Limit how often a function is executed.
Deeply clone an object or array.
Flatten deeply nested arrays into a single-level array.
Format a date object into a readable string.
Check whether a number is prime.
Merge two objects into one.
Generate a random number within a given range.
Truncate a string and add ...
if it exceeds the specified length.
Return a new array with only unique values.
ISC
Made with 💙 by Prem Chavan