A collection of modern, typed JavaScript utility functions for working with arrays, DOM elements, objects, and timing.
npm install @bnidev/js-utils
pnpm add @bnidev/js-utils
yarn add @bnidev/js-utils
import { debounceFn, flattenArray, deepClone } from "@bnidev/js-utils";
// Debounce any function
const log = (val: string) => console.log(val);
const debouncedLog = debounceFn(log, 300);
// Flatten nested arrays
flattenArray([1, [2, 3], [[4]], 5]); // โ [1, 2, 3, 4, 5]
// Deep clone objects
const copy = deepClone({ a: { b: 1 } });
You can find the full documentation for all utility functions, including parameters and return types here:
๐ View full documentation
Generated automatically using TypeDoc.
Run lint and formatting checks:
pnpm run check
Run lint and formatting checks & autofix if possible:
pnpm run check:fix
Run tests with coverage report:
pnpm run test:coverage
Build the package:
pnpm run build
Generate docs:
pnpm run docs:build