Comprehensive documentation for all utilities in the @setemiojo/utils library.
Utilities for working with arrays and array-like objects.
- Array conversion (
toArray,flattenArrayable,mergeArrayable) - Array manipulation (
partition,uniq,uniqueBy,remove,move,shuffle) - Array access (
at,last,sample) - Array generation (
range) - Array utilities (
clampArrayRange,filterInPlace)
Core utility functions and helpers.
- Assertions (
assert) - Type utilities (
toString,getTypeName) - Common helpers (
noop)
Utilities for deep equality comparison.
- Deep equality (
isDeepEqual)
Utilities for working with functions and function execution.
- Function execution (
batchInvoke,invoke,tap)
Type guards for filtering and type narrowing.
- Null and undefined guards (
notNullish,noNull,notUndefined) - Truthy guards (
isTruthy)
Type checking utilities for runtime type validation.
- Basic type checks (
isDef,isUndefined,isNull,isBoolean,isNumber,isString,isFunction,isObject) - Primitive checks (
isPrimitive) - Specialized checks (
isRegExp,isDate,isWindow,isBrowser)
Utilities for mathematical operations and calculations.
- Basic math (
clamp,sum) - Interpolation (
lerp,remap)
Utilities for working with objects and object manipulation.
- Object transformation (
objectMap) - Object access (
objectKeys,objectEntries,isKeyOf) - Object merging (
deepMerge,deepMergeWithArray) - Object selection (
objectPick) - Object utilities (
clearUndefined,hasOwnProperty,objectId)
Utilities for working with promises and asynchronous operations.
- Promise management (
createSingletonPromise,sleep,createPromiseLock,createControlledPromise)
Utilities for working with strings and text manipulation.
- String manipulation (
slash,ensurePrefix,ensureSuffix,capitalize) - String templates (
template) - String generation (
randomStr) - String formatting (
unindent)
Utilities for working with time and timestamps.
- Timestamp generation (
timestamp)
Utility for managing multiple promises with a fluent API.
- Promise collection and chaining
- Concurrency control
- Additional methods (
forEach,reduce,clear)
import {
// String utilities
capitalize,
createSingletonPromise,
deepMerge,
isObject,
isString, // Type guards
notNullish,
// Object utilities
objectMap,
objectPick,
partition,
randomStr, // Promise utilities
sleep,
template, // Array utilities
toArray,
uniq,
// And many more...
} from '@setemiojo/utils'npm install @setemiojo/utils
# or
yarn add @setemiojo/utils
# or
pnpm add @setemiojo/utils
# or
bun add @setemiojo/utilsAll utilities are fully typed and provide excellent TypeScript support with proper type inference and narrowing.
See CONTRIBUTING.md for guidelines on contributing to this project.