Functions
LazyKit currently includes 75 TypeScript functions. The files live in one flat documentation collection; the categories below come entirely from each page’s frontmatter.
Arrays
chunkSplits an array into fixed-size groups and controls how an incomplete final group is handled.
compactReturns the truthy values from an array while preserving their order.
countByCounts array values by a derived property key.
differenceReturns values from the first array that do not occur in the comparison arrays.
differenceByReturns values whose derived keys do not occur in the comparison arrays.
intersectionReturns distinct values shared by every provided array.
intersectionByReturns the first value for each derived key shared by all arrays.
keyByIndexes array values by a derived property key.
maxByFinds the first item with the largest finite derived number.
minByFinds the first item with the smallest finite derived number.
moveItemMoves an item to another existing index without mutating the array.
orderByStably sorts a copied array from independently directed selector values.
partitionSplits an array into matching and non-matching groups using a predicate.
rangeGenerates an ascending or descending numeric range that excludes its end.
shuffleProduces a shuffled copy of an array using the Fisher–Yates algorithm.
slidingWindowCreates overlapping fixed-size windows from an array.
sortByStably sorts a copied array from selector values computed once per item.
sumBySums finite numeric values produced by a selector.
unionByCombines arrays while keeping the first value for each derived key.
uniqueRemoves duplicate values while preserving their first-seen order.
uniqueByKeeps the first value for each distinct derived key.
zipGroups values that share the same index across multiple arrays.
Async
mapConcurrentMaps values asynchronously with bounded concurrency and source-ordered results.
memoizeAsyncShares and caches asynchronous work by receiver and arguments.
pLimitCreates a scheduler that limits concurrently running async tasks.
pollRepeats an operation until its result satisfies a condition.
promiseAllObjectResolves a plain object's promise values while preserving its keys.
Formatting
formatBytesFormats a byte count using decimal or binary units.
formatDurationFormats milliseconds as a compact multi-unit duration.
Functional
createEventEmitterCreates a synchronous, type-safe event emitter.
debounceDelays a function until calls have stopped for a specified duration.
memoizeMemoizes successful synchronous results by receiver and arguments.
onceInvokes a function once and reuses its return value or thrown error.
pipePasses a value through unary functions from left to right.
retryRepeats a failing operation until it succeeds or reaches an attempt limit.
sleepResolves a promise after a specified delay.
throttleRuns immediately, then drops calls until a specified interval has elapsed.
tryCatchRuns synchronous or asynchronous work and returns an error-first result tuple.
withCallCountWraps a function and tracks how many times the wrapper is invoked.
withTimeoutWraps a function and rejects when waiting for its result exceeds a deadline.
Numbers
roundToRounds finite numbers safely across decimal positions and extreme magnitudes.
Objects
compactObjectRecursively removes null and undefined properties and array entries.
filterObjectKeeps the own enumerable properties that satisfy a predicate.
flattenObjectFlattens nested plain objects into dot-delimited keys.
getPathReads an own property using dot notation or explicit path segments.
hasPathChecks whether every segment of an object path exists as an own property.
invertExchanges an object's keys and property-key values.
mapKeysTransforms an object's own enumerable keys.
mapObjectTransforms each own enumerable value while preserving its property key.
mergeDeepRecursively merges plain objects while replacing arrays and class instances.
omitCopies an object without a selected set of properties.
pickCopies a selected set of properties from an object.
renameKeysCopies a plain object and simultaneously renames selected properties.
setPathImmutably sets a value using dot notation or explicit path segments.
stableStringifySerializes values with deterministic object-key ordering.
unflattenObjectExpands dot-delimited keys into nested plain objects.
unsetPathImmutably removes an own property at an object path.
updatePathImmutably updates a value at an object path.
Strings
camelCaseConverts text from common word boundaries into camel case.
escapeHtmlEscapes characters with special meaning in HTML text and attributes.
interpolateReplaces nested placeholders with values from an object.
kebabCaseConverts text from common word boundaries into lowercase kebab case.
pascalCaseConverts text from common word boundaries into Pascal case.
slugifyConverts text into a lowercase, URL-safe Unicode slug.
snakeCaseConverts text from common word boundaries into lowercase snake case.
stripIndentRemoves shared indentation from multiline text.
titleCaseConverts text from common word boundaries into readable title case.
truncateTruncates text to a maximum grapheme length including its marker.
truncateMiddleTruncates the middle of text by grapheme while preserving both ends.
unescapeHtmlDecodes the HTML entities produced by escapeHtml.
Validation
isPlainObjectChecks for object literals and null-prototype records.
Web APIs
downloadBlobStarts a browser download for an in-memory Blob.
joinUrlJoins URL or path segments without damaging the protocol or suffix.
loadScriptLoads browser scripts with URL deduplication and safe retry behavior.
withQueryParamsAdds, replaces, repeats, or removes URL query parameters.