Skip to content

Changelog — Helpers by version

All helpers listed by the version in which they were introduced, from newest to oldest.

FunctionCategoryDescription
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
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.
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.
isArrayBuffertypeChecks if a value is an ArrayBuffer instance. Useful for filtering or type-narrowing in a functional pipeline: values.filter(isArrayBuffer)
isBlobtypeChecks if a value is a Blob instance. Useful for filtering or type-narrowing in a functional pipeline: values.filter(isBlob)
isBuffertypeChecks 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)
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.
isFormDatatypeChecks if a value is a FormData instance. Useful for filtering or type-narrowing in a functional pipeline: values.filter(isFormData)
isPrereleaseversionReturns true when the version string has a prerelease suffix (i.e. contains a - after the core MAJOR.MINOR.PATCH).
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.
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.
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.
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.
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.
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).
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.
deepCompareobjectDeep comparison of two objects that returns detailed information about differences.
deepEqualsarrayDeep comparison of two arrays that only returns true or false. Arrays are considered equal if they have the same length and all elements at corresponding positions are strictly equal. Only compares arrays, does not go into deep object comparison.
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).
equalsarraySimple helper that checks if two lists are identical. The order of elements in the list is not important.
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.
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.
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.
isAsyncFunctiontypeChecks if a value is an async function. Returns true for any function declared with async.
isBigInttypeChecks if a value is a bigint.
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.
isDatetypeChecks if a value is a Date instance. Note: this only checks the type, not whether the Date is valid. Use isValidDate 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).
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.
isNegativeNumbertypeChecks if a value is a number less than 0. Returns false for NaN, 0, positive numbers, and non-number types.
isNonEmptyArraytypeChecks if a value is a non-empty array (length > 0).
isNonEmptyStringtypeChecks if a value is a non-empty string (length > 0).
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.
isPositiveNumbertypeChecks if a value is a number greater than 0. Returns false for NaN, 0, negative numbers, and non-number types.
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.
isValidDatetypeChecks if a value is a valid Date instance (not Invalid Date). Unlike isDate, 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.
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+.
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.
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)
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.
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.
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.
shallowEqualsarrayQuick comparison of two arrays using JSON.stringify. This is a fast but simple comparison that may not work for all edge cases.
shallowEqualsobjectQuick comparison of two objects using JSON.stringify. This is a fast but simple comparison that may not work for all edge cases.
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.
sumnumberCalculates the sum of an array of numbers.
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()).
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.
uuid7mathGenerates 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.
FunctionCategoryDescription
camelCasestringConverts kebab-case to camelCase
capitalizestringCapitalizes the first letter of a string
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
createSortByDateFnarrayCreates a sort function for objects by date property
createSortByNumberFnarrayCreates a sort function for objects by number property
createSortByStringFnarrayCreates a sort function for objects by string property
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.
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.
oneInCommonarraySimple helper that check if two lists shared at least an item in common.
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.