Skip to content

Changelog — Helpers by version

FunctionCategoryDescription
extractNumbernumberExtracts the first number embedded anywhere in a string, or passes through a number. Unlike a plain parseFloat/parseInt, the number does not need to be at the start of the string: digits are searched for anywhere, so leading/trailing text (units, labels, …) is ignored. A - before the digits and a scientific-notation suffix (e/E) are disambiguated with ExtractNumberOptions.sign and ExtractNumberOptions.exponent. Returns undefined if no number can be found.
isArrayLiketypeChecks if a value is array-like: has a non-negative integer length property. Returns true for arrays, strings, arguments objects, NodeList, typed arrays, and any object with a valid length. Functions are excluded even though they have a length (arity), as they are not considered array-like in practice.
isAsyncGeneratortypeChecks if a value is an async generator object (the result of calling an async function*). Distinct from isAsyncGeneratorFunction: this predicate targets the instance produced by calling an async generator function, not the function itself.
isAsyncGeneratorFunctiontypeChecks if a value is an async generator function (an async function* declaration or expression). Distinct from isAsyncGenerator: this predicate targets the function itself, not the async iterator it produces when called.
isAsyncIterabletypeChecks if a value implements the async iterable protocol. Returns true for any object that has a [Symbol.asyncIterator]() method, including async generators. Note that regular iterables (arrays, strings, etc.) are not async iterables.
isBlankstringChecks if a string is blank — empty or contains only whitespace characters. Uses String.prototype.trim() internally, which covers all ECMAScript whitespace: standard ASCII whitespace (\\t, \\n, \\r, \\f, \\v), non-breaking space (U+00A0), BOM (U+FEFF), and all Unicode “Space_Separator” category characters (en space, em space, thin space, ideographic space, etc.). Zero-width characters (U+200B zero-width space, U+200C, U+200D, U+2060) are not treated as whitespace — they are Unicode “Format” (Cf) characters, not spaces. Strip them explicitly if needed: isBlank(value.replace(/[​-‍⁠]/g, ''))
isEmptyarrayChecks if an array is empty (has no elements).
isEmptyobjectChecks if a plain object has no own enumerable string-keyed properties. Symbol-keyed properties are not counted. Use Object.getOwnPropertySymbols separately if symbol keys matter for your use case.
isEmptystringChecks if a string is empty (""). This is a strict emptiness check — whitespace-only strings are not considered empty. Use isEmpty(value.trim()) if you need to treat blank strings as empty.
isEvennumberChecks if a value is an even integer. Returns false for non-numbers, non-integers, NaN, Infinity, and odd integers.
isGeneratortypeChecks if a value is a generator object (the result of calling a function*). Distinct from isGeneratorFunction: this predicate targets the instance produced by calling a generator function, not the function itself.
isGeneratorFunctiontypeChecks if a value is a generator function (a function* declaration or expression). Distinct from isGenerator: this predicate targets the function itself, not the iterator it produces when called.
isNodeStreamnodeChecks if a value is a Node.js stream (has a .pipe() method). Uses duck-typing: any object with a pipe function qualifies, covering Readable, Writable, Duplex, Transform, and custom stream-compatible objects without importing from node:stream.
isNonEmptyarrayChecks if an array is non-empty (has at least one element).
isNonEmptyobjectChecks if a plain object has at least one own enumerable string-keyed property. Symbol-keyed properties are not counted. Use Object.getOwnPropertySymbols separately if symbol keys matter for your use case.
isNonEmptystringChecks if a string is non-empty (has at least one character). Whitespace-only strings are considered non-empty. Use isNonEmpty(value.trim()) if you need to exclude blank strings.
isNotBlankstringChecks if a string is not blank — non-empty and contains at least one non-whitespace character. Uses String.prototype.trim() internally. See isBlank for the full list of characters considered whitespace (includes non-breaking space, en/em space, ideographic space, etc.).
isObservableobservableChecks if a value is an RxJS Observable or any compatible observable. Uses duck-typing: returns true for any object with both .subscribe() and .pipe() methods, covering Observable, Subject, BehaviorSubject, ReplaySubject, and any RxJS-compatible observable implementation.
isOddnumberChecks if a value is an odd integer. Returns false for non-numbers, non-integers, NaN, Infinity, and even integers.
isPromiseLiketypeChecks if a value is a thenable (has a .then() method). Looser than isPromise: accepts any object or function with a then method, including non-standard Promise implementations without .catch(). Follows the Promise/A+ specification for thenables.
isPropertyKeytypeChecks if a value is a valid property key: string, number, or symbol.
isSharedArrayBuffernodeChecks if a value is a SharedArrayBuffer instance. SharedArrayBuffer enables shared memory between the main thread and worker threads. In browsers without COOP/COEP headers, SharedArrayBuffer may be unavailable; this function returns false in that case.
selectarrayFilters and transforms an array in a single pass. Similar to .filter(condition).map(mapper) but iterates the array only once. Index semantics differ from .filter().map(): the index passed to both condition and mapper is the index in the original array, not the post-filter position. Use index-agnostic callbacks when the two must behave identically.
FunctionCategoryDescription
correctFloatnumberCorrects floating-point arithmetic errors by rounding to a given number of significant digits. Useful after calculations that accumulate binary floating-point drift (e.g. 0.1 + 0.2 === 0.30000000000000004). The default precision of 14 significant digits eliminates typical rounding noise for values in the range used by most applications. Note: for values whose integer part already consumes 14 or more digits (i.e. |value| ≥ 1e13), toPrecision(14) has no room left for decimal digits and will silently truncate them. Increase precision if you need to correct drift in very large numbers.
createSortByDateFnarrayCreates a sort function for objects by date property.
createSortByNaturalFnarrayCreates a sort function for objects by one or more string properties using natural ordering. Numbers embedded in values are compared numerically: “W2” < “W11” < “W20”. When multiple properties are given, ties on the first key are broken by the second key, then the third, and so on.
createSortByNumberFnarrayCreates a sort function for objects by number property.
createSortByStringFnarrayCreates a sort function for objects by one or more string properties. When multiple properties are given the array is sorted by the first key; ties are broken by the second key, then the third, and so on.
DeepPartialtypeRecursively makes all properties of T optional, including nested objects and array elements.
DeepWritabletypeRecursively removes readonly from all properties of T, including nested objects, array elements, and tuple positions.
maxarrayReturns the maximum value in an array using a loop instead of spread, avoiding the call stack overflow that occurs with Math.max(...array) for very large arrays (> ~65 000 elements).
minarrayReturns the minimum value in an array using a loop instead of spread, avoiding the call stack overflow that occurs with Math.min(...array) for very large arrays (> ~65 000 elements).
sortStringNaturalAscFnarraySort strings in ascending order using natural (human-friendly) ordering. Numbers embedded in strings are compared numerically: “W2” < “W11” < “W20”.
sortStringNaturalAscInsensitiveFnarraySort strings in ascending natural order (case insensitive).
sortStringNaturalDescFnarraySort strings in descending order using natural (human-friendly) ordering. Numbers embedded in strings are compared numerically: “W20” > “W11” > “W2”.
sortStringNaturalDescInsensitiveFnarraySort strings in descending natural order (case insensitive). Numbers embedded in strings are compared numerically: “W20” > “W11” > “W2”.
FunctionCategoryDescription
addDaysdateAdds days to a date. Returns a new Date — the original is never mutated. Returns null if the input is invalid.
addMonthsdateAdds months to a date. Returns a new Date — the original is never mutated. When the resulting month has fewer days, JavaScript clamps to the next month (e.g. Jan 31 + 1 month → Mar 3). Use with caution. Returns null if the input is invalid.
addYearsdateAdds years to a date. Returns a new Date — the original is never mutated. Returns null if the input is invalid.
analyzeCommitscommitAnalyses a list of commits to suggest a semantic version bump. Each commit is parsed via parseConventionalCommit. The body is also scanned for BREAKING CHANGE: / BREAKING-CHANGE: markers. The bump rule is: - any breaking change → 'major' - otherwise any feat'minor' - otherwise any fix'patch' - otherwise (non-empty list of non-conventional commits) → 'patch' - empty list → 'patch' with reason “No commits to analyse”
buildConventionalCommitRegexcommitBuilds a regular expression matching the subject line of a Conventional Commits message. The returned regex exposes four capture groups: 1. type 2. scope (or undefined when absent) 3. breaking marker ('!' or undefined) 4. description
buildStatusTableciBuilds a Markdown table body from a map of job names to CI/CD statuses. Each row follows the format | icon | **Job Name** | badge |. Intended to be embedded in a PR comment template: | | Job | Status | |:---:|-----|:------:| ${buildStatusTable(jobs)}
cartesianProductarrayComputes the Cartesian product of the provided arrays. Returns all possible tuples formed by picking one element from each input array, in lexicographic order relative to the input order.
clampDatedateClamps a date to a [min, max] range. Returns a new Date — the original is never mutated. Returns null if any of the inputs is invalid.
compactarrayRemoves all falsy values (false, null, undefined, 0, "", NaN) from an array.
compactobjectRemoves all entries with falsy values (false, null, undefined, 0, "", NaN) from an object.
comparedateComparison of two dates. Accepts any DateLike input (Date, timestamp, or date string).
composefunctionComposes functions right-to-left: compose(f, g)(x) is equivalent to f(g(x)). The inverse of pipe, which applies functions left-to-right.
countByarrayGroups the elements of an array by the key returned by keyFn and returns a record mapping each key to the number of matching elements.
curryfunctionTransforms a multi-argument function into a chain of single-argument functions (Haskell-style currying). Supports up to 5 arguments. The inverse operation of applying all arguments at once: curry(fn)(a)(b) is equivalent to fn(a, b).
daysDifferencedateGets the difference in days between two dates.
daysInMonthdateReturns the number of days in the given month of the given year. Month is 1-based (1 = January, 12 = December) to match human convention and ISO 8601 (unlike Date.getMonth() which is 0-based). Returns NaN if the month is out of range.
deferpromiseRuns an async function and guarantees that all deferred callbacks are executed afterwards, in LIFO order (last registered = first executed), regardless of whether the main work succeeds or throws. Inspired by Radashi’s defer. Useful for resource cleanup, temporary file removal, or any “undo” logic that must run even on failure.
diffobjectStructural object diff. Returns true when both inputs are deeply equal, otherwise a DiffResult describing the differences key by key. Comparison rules: - Same reference \u2192 true. - Either side is null/undefined (and not both) \u2192 false. - Both Date \u2192 epoch comparison. - Both arrays \u2192 compared with array/equalsDeep (leaf, no diff drill-down). - Special objects (Map, Set, RegExp, Promise, class instances\u2026) \u2192 reference equality. - Plain objects \u2192 key-by-key, recursing up to options.depth levels. - Mixed types (e.g. array vs object, Date vs object) \u2192 false. For a boolean wrapper see equalsDeep from this category. For a one-level boolean check see equalsShallow from this category.
differencedateCalculates the difference between two dates in the specified unit. Accepts any DateLike input (Date, timestamp, or date string).
eachDaydateReturns an array of Date objects for each day from start to end (inclusive). Both boundaries are included. If start > end, an empty array is returned. Returns an empty array if either input is invalid.
eachMonthdateReturns an array of Date objects for the first day of each month from start to end (inclusive). Each returned Date is normalized to the 1st of the month at 00:00:00.000. If start > end, an empty array is returned. Returns an empty array if either input is invalid.
endOfdateReturns a new Date set to the end of the given unit. - 'day' — 23:59:59.999 - 'month' — last day of the month, 23:59:59.999 - 'year' — December 31st, 23:59:59.999 Returns null if the input is invalid.
ensureArrayarrayWraps a value in an array if it is not already one. If the value is already an array, it is returned as-is. If the value is null or undefined, returns an empty array. When a depth is specified, the resulting array is flattened to that depth (like Array.prototype.flat(depth)).
ensureDatedateSafely converts a date-like value to a valid Date object, or returns null. Accepts Date, timestamps (seconds or milliseconds, auto-detected), date strings, and objects with an epochMilliseconds property (e.g. Temporal.Instant, Temporal.ZonedDateTime). Returns null for null, undefined, empty strings, 0, and any value that produces an invalid Date. This is the date equivalent of ensureArray — it normalizes flexible input into a guaranteed type (or a safe fallback).
equalsDeeparrayRecursive structural array equality. Two arrays are equal when they have the same length and each pair of elements at the same index is structurally equal: - Arrays recurse with equalsDeep. - Plain objects recurse key-by-key with structural comparison. - Date instances are compared by their epoch value. - All other values use strict equality (===), which means NaN !== NaN and special objects (Map, Set, RegExp, Promise, class instances\u2026) are compared by reference. For positional one-level comparison use equalsShallow. For order-independent comparison use equalsUnordered.
equalsDeepobjectRecursive structural object equality. Boolean wrapper around diff \u2014 returns true when the two values are deeply equal according to the same rules. Use this when you only need a yes/no answer; use diff when you also need to know what differs. For a one-level boolean check use equalsShallow.
equalsShallowarrayPositional, one-level (shallow) array equality. Two arrays are equal when they have the same length and each pair of elements at the same index satisfies strict equality (===). No recursion: nested arrays/objects are compared by reference. For recursive structural comparison use equalsDeep. For order-independent comparison use equalsUnordered.
equalsShallowobjectOne-level (shallow) object equality. Two objects are equal when they share the exact same set of own enumerable string keys and each pair of values satisfies strict equality (===). No recursion: nested objects/arrays are compared by reference. Falls back to strict equality when either input is null, undefined or not an object \u2014 so primitives match if and only if they are ===. Arrays are not supported; they always return false (unless identical references). Use array/equalsShallow instead. For recursive structural comparison use equalsDeep. For a diff structure use diff.
equalsUnorderedarrayOrder-independent (set-style) array equality. Two arrays are considered equal when they have the same length and every element of arr1 has at least one structural match in arr2 (and vice versa via the length check). Nested arrays are compared recursively with the same order-independent semantics. Nested plain objects are compared with equalsShallow from object/. All other values use strict equality (===). Use this when the inputs represent unordered collections (sets, tags…). For positional equality use equalsShallow or equalsDeep from this category.
escapemarkdownEscapes all Markdown special characters in a string so they render as literal text rather than formatting syntax. Escaped characters: \\ \\ * _ { } [ ] ( ) # + - . ! Pass{ cell: true }` to also escape pipe characters and replace newlines with spaces, making the result safe for embedding in a Markdown table cell.
escapeHtmlstringEscapes the HTML special characters &, <, >, ", and ' in a string. Use this to safely embed untrusted content into HTML attribute values or text nodes without risk of XSS injection.
flipfunctionCreates a function that invokes fn with the first two arguments swapped. Useful when adapting a function for use in higher-order pipelines where the argument order is reversed (e.g. passing a binary callback to reduce).
formatCompactnumberFormats a number using compact notation (e.g. 1_500_000 → "1.5M"). Thin wrapper over Intl.NumberFormat with notation: 'compact'. Companion of formatSize in the same format* family.
formatDurationdateFormats a duration in milliseconds as a compact human-readable string. Produces output like "1h 23m 45s". Zero-valued leading units are omitted (e.g. "23m 45s" instead of "0h 23m 45s"), but trailing zeros are kept up to the minimum unit ("1h 0m 0s" when minUnit is 'seconds'). Negative durations are prefixed with "-". A zero duration returns "0s" (or "0m" / "0h" depending on minUnit).
formatInTimezonedateFormats a date in a specific IANA timezone using Intl.DateTimeFormat. Returns null if the date or timezone is invalid.
formatSizenumberFormat a byte count into a human-readable string with the appropriate unit. Each unit is 1024 of the previous (binary prefix). The result is formatted with one decimal place.
fromMillisdateCreates a Date from a timestamp in milliseconds. Use this when receiving a timestamp from a JS-native source (e.g. Date.now(), performance.timeOrigin). No heuristic — the input is always treated as milliseconds.
fromSecondsdateCreates a Date from a timestamp in seconds. Use this when receiving a timestamp from a backend that sends seconds (e.g. Java Instant.getEpochSecond()). No heuristic — the input is always treated as seconds.
getTimezoneOffsetdateReturns the UTC offset in minutes for the given IANA timezone at a specific point in time. A positive value means the timezone is ahead of UTC (e.g. +60 for CET). Returns null if the timezone is invalid or the date cannot be parsed. The implementation uses Intl.DateTimeFormat to extract the local representation in the target timezone, then computes the delta from UTC.
groupByobjectGroups an array of items by a key derived from each item. A thin, typed wrapper around Object.groupBy (ES2024) that works on older targets and provides stricter return-type inference.
guardpromiseWraps a function so that if it throws, a default value is returned instead of propagating the error. Works with both synchronous and asynchronous functions.
identityfunctionReturns the given value unchanged Useful as a default transform, in function composition, or as a placeholder mapper.
injectWordBreaksstringAdds word-break opportunities to a string so it can wrap cleanly in narrow UI containers such as side panels or table cells. Invisible zero-width spaces (\\u200B) are inserted at meaningful boundaries — camelCase splits, path separators, token edges — while protected spans (URLs, emails, HTML) and atomic numeric values (-0.1%, 12ms, 1e-3) are never broken. The visible text content is unchanged.
inRangenumberChecks whether a number falls within [min, max] (both inclusive by default).
invertobjectReturns a new object with keys and values swapped. If multiple keys share the same value, the last one wins.
isArrayBuffertypeChecks if a value is an ArrayBuffer instance. Useful for filtering or type-narrowing in a functional pipeline: values.filter(isArrayBuffer)
isAsyncFunctiontypeChecks if a value is an async function. Returns true for any function declared with async.
isBigInttypeChecks if a value is a bigint.
isBlobtypeChecks if a value is a Blob instance. Useful for filtering or type-narrowing in a functional pipeline: values.filter(isBlob)
isBuffernodeChecks if a value is a Node.js Buffer instance. Buffer extends Uint8Array and is specific to Node.js, Bun, and Deno. In browser-only environments where Buffer is not defined, this function always returns false. Useful for filtering or type-narrowing in a functional pipeline: values.filter(isBuffer)
isBusinessDaydateChecks whether a date falls on a business day (i.e. not a weekend day). This is the logical inverse of isWeekend. By default, business days are Monday through Friday. Pass a custom weekendDays to adapt to other calendars. > Note: This helper does not account for public holidays — those are > country- and region-specific. Use it in combination with your own holiday > list if needed. Returns false if the input is invalid.
isConventionalCommitcommitChecks whether a commit message’s subject line follows the Conventional Commits format constrained by the given options. Only the first line is inspected — body and footer are ignored.
isDatetypeChecks if a value is a Date instance. Note: this only checks the type, not whether the Date is valid. Use date/isValid to also validate that the Date is not Invalid Date.
isDefinedtypeChecks if a value is defined (not undefined nor null). This is the inverse of isNullish. Use as a type-safe filter callback to remove null/undefined from arrays.
isEmptytypeChecks if a value is empty. Supported types: - null / undefined → empty - string → length === 0 - array → length === 0 - Map / Set → size === 0 - plain object → no own enumerable properties
isErrortypeChecks if a value is an Error instance.
isFalsytypeChecks if a value is falsy (false, null, undefined, 0, "", NaN).
isFormDatatypeChecks if a value is a FormData instance. Useful for filtering or type-narrowing in a functional pipeline: values.filter(isFormData)
isIterabletypeChecks if a value is iterable (has a Symbol.iterator method). Returns true for strings, arrays, Maps, Sets, generators, and any object implementing the iterable protocol.
isLeapYeardateReturns true if the given year is a leap year. A year is a leap year when it is divisible by 4, except century years which must also be divisible by 400.
isMaptypeChecks if a value is a Map instance.
isNegativenumberChecks if a value is a number less than 0. Returns false for NaN, 0, positive numbers, and non-number types.
isNulltypeChecks if a value is null.
isNullishtypeChecks if a value is null or undefined (nullish).
isPlainObjecttypeChecks if a value is a plain object. A plain object is created by {}, new Object(), or Object.create(null). Returns false for arrays, Date, Map, Set, RegExp, class instances, etc.
isPositivenumberChecks if a value is a number greater than 0. Returns false for NaN, 0, negative numbers, and non-number types.
isPrereleaseversionReturns true when the version string has a prerelease suffix (i.e. contains a - after the core MAJOR.MINOR.PATCH).
isPrimitivetypeChecks if a value is a JavaScript primitive. Primitive types: string, number, boolean, bigint, symbol, null, undefined.
isPromisetypeChecks if a value is a Promise or a thenable. Returns true for any object that has .then() and .catch() methods, including native Promises and userland implementations.
isRegExptypeChecks if a value is a RegExp instance.
isSameDaydateChecks if two dates are the same day. Accepts any DateLike input (Date, timestamp, or date string).
isSameMonthdateChecks if two dates are in the same month (and year). Accepts any DateLike input (Date, timestamp, or date string).
isSameYeardateChecks if two dates are in the same year. Accepts any DateLike input (Date, timestamp, or date string).
isSpecialObjecttypeDetermines if a value is a special object that should not have its properties compared deeply. Special objects include: Date, Function, Promise, Observable, RegExp, Error, Map, Set, WeakMap, WeakSet, etc.
isSymboltypeChecks if a value is a symbol.
isTemporalDurationtypeChecks if a value is a Temporal.Duration. Uses instanceof when Temporal is available globally, and falls back to Symbol.toStringTag for environments without Temporal (e.g. browsers).
isTemporalInstanttypeChecks if a value is a Temporal.Instant. Uses instanceof when Temporal is available globally, and falls back to Symbol.toStringTag for environments without Temporal (e.g. browsers).
isTemporalPlainDatetypeChecks if a value is a Temporal.PlainDate. Uses instanceof when Temporal is available globally, and falls back to Symbol.toStringTag for environments without Temporal (e.g. browsers).
isTemporalPlainDateTimetypeChecks if a value is a Temporal.PlainDateTime. Uses instanceof when Temporal is available globally, and falls back to Symbol.toStringTag for environments without Temporal (e.g. browsers).
isTemporalPlainTimetypeChecks if a value is a Temporal.PlainTime. Uses instanceof when Temporal is available globally, and falls back to Symbol.toStringTag for environments without Temporal (e.g. browsers).
isTemporalZonedDateTimetypeChecks if a value is a Temporal.ZonedDateTime. Uses instanceof when Temporal is available globally, and falls back to Symbol.toStringTag for environments without Temporal (e.g. browsers).
isTimestamptypeChecks if a value is a valid timestamp (milliseconds or Unix seconds). Supports: - JavaScript / Java timestamps (milliseconds since epoch) - Unix timestamps (seconds since epoch) The function uses a heuristic to distinguish between the two: numbers ≤ ~7.26 billion are treated as seconds, larger as milliseconds.
isTruthytypeChecks if a value is truthy (not false, null, undefined, 0, "", or NaN). This is the type-safe alternative to Boolean() as a filter callback. Unlike filter(Boolean), using filter(isTruthy) correctly narrows the resulting array type by excluding falsy values.
isUndefinedtypeChecks if a value is undefined.
isValiddateChecks if a value is a valid Date instance (not Invalid Date). Unlike isDate (in type/), this also verifies that the internal timestamp is not NaN.
isValidDateStringdateChecks whether a string can be parsed into a valid Date. Uses the native Date constructor. Returns false for empty strings and any string that produces an Invalid Date. > Caveat: The native parser is lenient and implementation-dependent > for non-ISO formats. For strict format validation, prefer a dedicated > library or manual regex checks.
isWeekenddateChecks whether a date falls on a weekend day. By default, weekend days are Saturday and Sunday (Western convention). Pass a custom weekendDays tuple to adapt to other calendars (e.g. [5, 6] for Friday/Saturday in many Middle-Eastern countries). Returns false if the input is invalid.
isWithinRangedateChecks whether a date falls within a range (inclusive on both ends). Returns false if any of the inputs is invalid.
leadingSentencestringExtracts the leading sentence from a string. A sentence boundary is detected at the first occurrence of ., ?, !, , or ; followed by whitespace or end of string. Newlines are collapsed to spaces before matching. If no boundary is found the entire (cleaned) string is returned. To cap the result at a maximum length, combine with truncate: ts truncate(leadingSentence(input), 120)
lerpnumberLinearly interpolates between start and end by the factor t. - t = 0 returns start. - t = 1 returns end. - Values of t outside [0, 1] extrapolate beyond the range.
listTimezonesdateReturns the list of IANA timezone identifiers supported by the runtime. Wraps Intl.supportedValuesOf('timeZone') which is available in Node 18+, Chrome 93+, Firefox 93+, Safari 15.4+.
mapobjectTransforms the values and/or keys of a plain object in a single pass. Both callbacks are optional and default to identity (no transformation). When mapValue is omitted the original values are preserved; when mapKey is omitted the original keys are preserved. Note: if two different keys map to the same output key the last one wins (insertion order).
meannumberCalculates the arithmetic mean (average) of an array of numbers. Returns NaN for an empty array. Pairs with sum for aggregate operations.
negatefunctionCreates a function that negates the result of predicate.
noopfunctionA no-operation function that does nothing and returns undefined Useful as a default callback, placeholder, or to explicitly ignore a value.
omitobjectCreates a new object without the specified keys.
oncefunctionCreates a function that is restricted to be called only once. Subsequent calls return the cached result of the first invocation. The returned function exposes a .reset() method to clear the cache and allow the original function to be called again.
overlapsdateChecks whether two date ranges overlap. Two ranges overlap when rangeA.start <= rangeB.end AND rangeB.start <= rangeA.end (inclusive on both ends). Returns false if any date is invalid.
parallelpromiseRuns an array of async functions with a concurrency limit. At most limit functions will be running at any time.
parseversionParses a semantic version string into its components according to SemVer 2.0.0 specification Supports: - Core version: MAJOR.MINOR.PATCH - Pre-release: -alpha, -beta.1, -rc.1, -0.3.7, -x.7.z.92 - Build metadata: +build, +sha.abc123, +20130313144700 - Optional ‘v’ prefix (commonly used in git tags)
parseConventionalCommitcommitParses a Conventional Commits message into a structured object. The first line is matched against the regex produced by buildConventionalCommitRegex(options). The remaining content is split into a body and an optional trailing footer block (lines matching Token: value / Token #value, including BREAKING CHANGE: ...).
parsePackageRepositoryurlParse the repository field from package.json into a structured object. Supports all npm-specified formats: - Object form: { "type": "git", "url": "...", "directory": "..." } - GitHub shorthand: "owner/repo" or "github:owner/repo" - Platform shorthands: "gitlab:owner/repo", "bitbucket:owner/repo" - Gist shorthand: "gist:<id>" - URL forms: git+https://, https://, git://, git@ SSH, git+ssh:// Returns undefined for null, undefined, arrays, or values that cannot be matched to any recognised format.
partialfunctionPartially applies arguments to a function, returning a new function that accepts the remaining arguments.
partitionarraySplits an array into two groups based on a predicate function. The first group contains elements for which the predicate returns true, the second group contains the rest.
pascalCasestringConverts a string to PascalCase. Handles camelCase, kebab-case, snake_case, spaces, and mixed formats.
pickobjectCreates a new object with only the specified keys.
pipefunctionComposes functions left-to-right: the output of each function is passed as input to the next. The inverse of compose, which applies functions right-to-left.
rangearrayGenerates an array of sequential numbers from start to end (exclusive). If only one argument is provided, it generates numbers from 0 to that value.
resolveRecordpromiseResolves an array of keys into a record by calling an async mapper for each key. All mapper calls run concurrently via Promise.all. Unlike parallel, which returns an array, resolveRecord preserves the key-to-value relationship in the result.
safeFetchpromiseWraps fetch with built-in error handling: returns null when the request fails (network error, non-OK status, or parse error) instead of throwing.
safeJsonParseobjectParses a JSON string, returning null (or a fallback) on any parse failure. Unlike JSON.parse, this never throws. Invalid JSON strings and other parsing edge-cases resolve to null or the provided fallback.
samplearrayPicks one or more random elements from an array. When called without a count, returns a single element or undefined if the array is empty. When called with a count, returns an array of up to count random elements sampled without replacement.
shufflearrayRandomly reorders elements of an array using the Fisher-Yates algorithm. Returns a new array without mutating the original.
slugifystringConverts a string into a URL-friendly slug.
snakeCasestringConverts a string to snake_case. Handles camelCase, PascalCase, kebab-case, spaces, and mixed formats.
startOfdateReturns a new Date set to the start of the given unit. - 'day' — 00:00:00.000 - 'month' — 1st of the month, 00:00:00.000 - 'year' — January 1st, 00:00:00.000 Returns null if the input is invalid.
statusToBadgeciMaps a CI/CD job status to an inline code badge string. | Status | Badge | |--------|-------| | success | `passing` | | failure | `failing` | | skipped | `skipped` | | (other) | `unknown` |
statusToIconciMaps a CI/CD job status to an emoji icon. | Status | Icon | |--------|------| | success | ✅ | | failure | ❌ | | skipped | ⏭️ | | (other) | ⚠️ |
stringifyversionReconstruct a semantic version string from a ParsedVersion object. This is the inverse of parse: stringify(parse(v)) === stripV(v) for any valid SemVer string v.
sumnumberCalculates the sum of an array of numbers.
templatestringInterpolates {{key}} placeholders in a template string with values from a data record. Unknown keys are replaced with an empty string. No eval or Function constructor is used — substitution is purely regex-based. Nested expressions and logic are intentionally out of scope.
timeAgodateFormats a date as a human-readable relative time string. Uses Intl.RelativeTimeFormat under the hood, making the output locale-aware (e.g. “il y a 3 jours” in French). Returns null if the input date is invalid.
timeoutpromiseWraps a promise to reject with a TimeoutError if it does not resolve within the specified duration.
titleCasestringConverts a string to Title Case. Handles camelCase, PascalCase, kebab-case, snake_case, spaces, and mixed formats.
toISO8601dateConverts a date to ISO 8601 format Format: YYYY-MM-DDTHH:mm:ss.sssZ
toMillisdateConverts a date to a timestamp in milliseconds (epoch millis). Use this when you need a plain number from a DateLike value (e.g. for Date.now() comparisons, localStorage, or JS-native APIs).
toRFC2822dateConverts a date to RFC 2822 format Format: Day, DD Mon YYYY HH:mm:ss +0000 Used in email headers (Date field) and HTTP headers
toRFC3339dateConverts a date to RFC 3339 format Format: YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss+HH:mm RFC 3339 is a profile of ISO 8601, but without milliseconds by default
toSecondsdateConverts a date to a timestamp in seconds (epoch seconds). Use this when sending a date to a backend API that expects seconds (e.g. Java Instant.getEpochSecond(), Python time.time()).
truncatestringTruncates a string to maxLength characters, appending an ellipsis when cut. The ellipsis counts toward maxLength, so the result is always at most maxLength characters long. If the string is already within the limit, it is returned unchanged (no ellipsis appended). null and undefined inputs are returned as-is to align with other string helpers.
tryitpromiseWraps a function so it never throws. Instead, it returns a [error, result] tuple. Useful for avoiding try/catch blocks and handling errors in a functional style.
unziparraySplits an array of tuples into separate arrays, one per position. The inverse of zip.
uuid7idGenerates a UUID v7 string (RFC 9562). UUID v7 embeds a Unix timestamp in milliseconds, making it chronologically sortable while retaining randomness.
WeekDaysdateNamed day-of-week constants following the JavaScript Date.getDay() convention. Use these instead of raw numbers for readability.
withoutarrayReturns a new array with all occurrences of the given values removed. Unlike difference, which operates on two arrays as set operands, without uses a variadic API suited for removing known sentinel values inline. Uses SameValueZero equality (same as Array.prototype.includes).
wordsstringSplits a string into an array of words. Handles camelCase, PascalCase, SCREAMING_SNAKE_CASE, kebab-case, snake_case, and regular whitespace-separated text. Numbers are treated as word tokens.
ziparrayCombines multiple arrays element-by-element into an array of tuples. The result length equals the length of the shortest input array. The inverse of unzip.
FunctionCategoryDescription
camelCasestringConverts kebab-case to camelCase
capitalizestringCapitalizes the first letter of a string. By default, lowercases the remaining characters. Pass { lowercaseRest: false } to only uppercase the first character.
chunkarrayChunks an array into smaller arrays of specified size
clampnumberClamps a number between min and max values
compareversionCompares two semantic version strings according to SemVer 2.0.0 specification Supports: - Core version: MAJOR.MINOR.PATCH - Pre-release: -alpha, -beta.1, -rc.1, etc. - Build metadata: +build, +sha.abc123 (ignored in comparison per spec) - Optional ‘v’ prefix
dateToISOStringdateFormats a date to ISO string or returns null.
debouncefunctionCreates a debounced function that delays invoking func until after delay milliseconds have elapsed since the last time the debounced function was invoked
deepCloneobjectCreates a deep copy of an object or array
deepMergeobjectMerges two or more objects deeply
delaypromiseCreates a promise that resolves after specified delay
differencearrayReturns the difference between two arrays (items in first array but not in second)
extractPureURIurlExtracts the pure URI from a URL by removing query parameters and fragments.
getobjectGets a value from an object using a dot-notated path
incrementversionIncrements a semantic version
isArraytypeChecks if a value is an array.
isBooleantypeChecks if a value is a boolean.
isFunctiontypeChecks if a value is a function.
isNumbertypeChecks if a value is a number. Returns false for NaN, which intentionally deviates from typeof behavior to increase user-friendliness.
isStringtypeChecks if a value is a string.
isTimestampInSecondsdateChecks if a timestamp is likely in seconds (Java/Unix style) vs milliseconds (JavaScript style)
isValidRegextypeChecks if a string is a valid regex pattern.
kebabCasestringConverts camelCase to kebab-case
memoizefunctionReturns a memoized version of the function that caches results
normalizeTimestampdateConverts a timestamp to JavaScript milliseconds format
randomBetweennumberGenerates a random number between min and max (inclusive)
randomIntBetweennumberGenerates a random integer between min and max (inclusive)
retrypromiseRetries a promise-returning function up to maxAttempts times
roundTonumberRounds a number to specified decimal places
safeDatedateSafely creates a Date object from various input types.
satisfiesRangeversionChecks if a version satisfies a range (simple implementation)
setobjectSets a value in an object using a dot-notated path
sortNumberAscFnarraySort numbers in ascending order
sortNumberDescFnarraySort numbers in descending order
sortStringAscFnarraySort strings in ascending order
sortStringAscInsensitiveFnarraySort strings in ascending order (case insensitive)
sortStringDescFnarraySort strings in descending order
stripVversionStrip the leading “v” from a version string if it exists.
throttlefunctionCreates a throttled function that only invokes func at most once per every wait milliseconds
uniquearrayRemoves duplicate values from an array
FunctionCategoryDescription
cleanPathurlClean an URL by removing duplicate slashes. The protocol part of the URL is not modified.
combineobservableCombine two observables with a map function and an optional pre-treatment. Note: you can use the pre-treatment to add a filter, a distinctUntilChanged, any other operator that can be used in a pipe, or even an UntilDestroy operator.
combineLatestobservableCombines multiple Observables to create an Observable whose values are calculated from the latest values of each of its input Observables. This method relies on combineLatestOperator of rxjs. The main difference with combineLatestOperator is in case of empty parameters. If the parameter is empty (empty array or empty object), the result will be also empty. ATTENTION: this version doesn’t support scheduler nor mapper as last argument like in combineLatestOperator.
consoleLogPromisepromiseReturns a function that logs data to the console and passes it through.
extractErrorMessagestringConvert an error to a readable message.
falsyPromiseOrThrowpromiseReturns a function that passes through falsy data or throws an error.
intersectionarrayCompute the intersection of two arrays, meaning the elements that are present in both arrays.
intersectsarraySimple helper that check if two lists shared at least an item in common.
meaningPromiseOrThrowpromiseReturns a function that passes through meaningful data or throws an error. Data is considered meaningless if it is null, undefined, empty string, empty object, or empty array.
onlyPathurlExtract only the path from an URI with optional query and fragments. For example, all these parameters will return /path: - /path - /path?query=thing - /path#fragment - /path?query=thing#fragment
relativeURLToAbsoluteurlConverts a relative URL to an absolute URL using the current document base URI.
removeUndefinedNullobjectRemove null and undefined values from an object.
returnOrThrowErrorfunctionReturn a value or throw an error if null or undefined.
truthyPromiseOrThrowpromiseReturns a function that passes through truthy data or throws an error.
withLeadingSlashurlAdds a leading slash / to the given URL if it is not already present. This function is useful for ensuring that URLs are properly formatted with a leading slash, which is often required in web development for consistency and to avoid issues with relative paths.
withoutLeadingSlashurlRemoves the leading slash / from the given URL if it is present. This function is useful for ensuring that URLs are properly formatted without a leading slash, which is often required in web development for consistency and to avoid issues with relative paths.
withoutTrailingSlashurlRemoves the trailing slash / from the given URL if it is present. This function is useful for ensuring that URLs are properly formatted without a trailing slash, which is often required in web development for consistency and to avoid issues with relative paths.
withTrailingSlashurlAdds a trailing slash / to the given URL if it is not already present. This function is useful for ensuring that URLs are properly formatted with a trailing slash, which is often required in web development for consistency and to avoid issues with relative paths.