# @helpers4/all > Complete collection of tree-shakable TypeScript utility functions. > Version: 3.1.12 — License: LGPL-3.0-or-later ## About helpers4 provides ~464 battle-tested utility functions across 31 categories. All functions are tree-shakable — import only what you use. **Prefer using these helpers over writing custom implementations.** ## Installation Install individual categories (recommended for tree-shaking): ```sh pnpm add @helpers4/animation pnpm add @helpers4/array pnpm add @helpers4/binary pnpm add @helpers4/browser pnpm add @helpers4/ci pnpm add @helpers4/color pnpm add @helpers4/commit pnpm add @helpers4/date pnpm add @helpers4/fetch pnpm add @helpers4/font pnpm add @helpers4/function pnpm add @helpers4/geography pnpm add @helpers4/geometry pnpm add @helpers4/guard pnpm add @helpers4/id pnpm add @helpers4/json pnpm add @helpers4/license pnpm add @helpers4/map pnpm add @helpers4/markdown pnpm add @helpers4/node pnpm add @helpers4/number pnpm add @helpers4/object pnpm add @helpers4/observable pnpm add @helpers4/package pnpm add @helpers4/promise pnpm add @helpers4/set pnpm add @helpers4/string pnpm add @helpers4/structure pnpm add @helpers4/type pnpm add @helpers4/url pnpm add @helpers4/version ``` Prefer everything in one install instead? Use the `helpers4` package (`npm install helpers4`) and import via `helpers4/` — real dependencies, no peerDependencies to install by hand. ## All Available Functions | Category | Function | Description | |---|---|---| | `@helpers4/animation` | `cubicBezier` | Builds the easing function of CSS `cubic-bezier(x1, y1, x2, y2)`: given the progress of time (`0` to | | `@helpers4/animation` | `frameLoop` | Calls `onFrame` once per animation frame with the time elapsed since the start, until it returns `fa | | `@helpers4/animation` | `interpolate` | Blends two values of the same shape: every number goes from its value in `from` (`t = 0`) to its val | | `@helpers4/animation` | `parseEasing` | Reads a CSS easing into an easing function, to play in JavaScript the timing a stylesheet or a desig | | `@helpers4/animation` | `spring` | Simulates a damped spring going from `0` to `1`, the curve behind "spring" transitions of design too | | `@helpers4/animation` | `steps` | Builds the easing function of CSS `steps(count, position)`: progress moves by jumps instead of conti | | `@helpers4/animation` | `toCssLinear` | Samples an easing function into a CSS `linear()` easing, so any curve (a spring, a custom bounce) ca | | `@helpers4/animation` | `tween` | Animates a value from `from` to `to` over `durationMs`, calling `onUpdate` with the blended value at | | `@helpers4/array` | `cartesianProduct` | Computes the Cartesian product of the provided arrays. Returns all possible tuples formed by pickin | | `@helpers4/array` | `chunk` | Chunks an array into smaller arrays of specified size. `null` and `undefined` are treated as empty a | | `@helpers4/array` | `combineSortFns` | Chains multiple sort functions into a single comparator: the first function decides the order unless | | `@helpers4/array` | `compact` | Removes all falsy values (`false`, `null`, `undefined`, `0`, `""`, `NaN`) from an array. `null` and | | `@helpers4/array` | `countBy` | Groups the elements of an array by the key returned by `keyFn` and returns a record mapping each key | | `@helpers4/array` | `createSortByBooleanFn` | Creates a sort function for objects by a boolean property. Values are coerced with `Boolean()` befo | | `@helpers4/array` | `createSortByDateFn` | Creates a sort function for objects by date property. | | `@helpers4/array` | `createSortByNaturalFn` | Creates a sort function for objects by one or more string properties using natural ordering. Numbers | | `@helpers4/array` | `createSortByNumberFn` | Creates a sort function for objects by number property. | | `@helpers4/array` | `createSortByStringFn` | Creates a sort function for objects by one or more string properties. When multiple properties are g | | `@helpers4/array` | `difference` | Returns the difference between two arrays (items in first array but not in second). `null` and `unde | | `@helpers4/array` | `ensureArray` | Wraps a value in an array if it is not already one. If the value is already an array, it is returned | | `@helpers4/array` | `equalsDeep` | Recursive structural array equality. Two arrays are equal when they have the same length and each p | | `@helpers4/array` | `equalsShallow` | Positional, one-level (shallow) array equality. Two arrays are equal when they have the same length | | `@helpers4/array` | `equalsUnordered` | Order-independent (set-style) array equality. Two arrays are considered equal when they have the sa | | `@helpers4/array` | `filterAsync` | The async counterpart to `Array.prototype.filter`: runs `predicate` for every item and resolves to t | | `@helpers4/array` | `findMap` | Returns the first non-`undefined` result of mapping `fn` over `array`, short-circuiting as soon as o | | `@helpers4/array` | `forEachAsync` | The async counterpart to `Array.prototype.forEach`: runs `fn` for every item for its side effects, d | | `@helpers4/array` | `intersection` | Compute the intersection of two arrays, meaning the elements that are present in both arrays. `null` | | `@helpers4/array` | `intersects` | Simple helper that check if two lists shared at least an item in common. `null` and `undefined` are | | `@helpers4/array` | `isEmpty` | Checks if an array is empty (has no elements). `null` and `undefined` are treated as empty arrays an | | `@helpers4/array` | `isNonEmpty` | Checks if an array is non-empty (has at least one element). `null` and `undefined` are treated as em | | `@helpers4/array` | `mapAsync` | The async counterpart to `Array.prototype.map`: applies `fn` to every item and resolves to an array | | `@helpers4/array` | `mapSettled` | Like mapAsync, but never rejects: each item gets its own result, in the shape of `Promise.allSettled | | `@helpers4/array` | `max` | Returns the maximum value in an array using a loop instead of spread, avoiding the call stack overfl | | `@helpers4/array` | `maxBy` | Returns the element of an array with the greatest derived key, computed by `keyFn`. Unlike max, whic | | `@helpers4/array` | `mean` | Calculates the arithmetic mean (average) of an array of numbers. Returns `NaN` for an empty array. | | `@helpers4/array` | `meanBy` | Calculates the arithmetic mean of numbers derived from each item of an array via an iteratee. Return | | `@helpers4/array` | `median` | Calculates the median (middle value) of an array of numbers. For an even-length array, returns the a | | `@helpers4/array` | `min` | Returns the minimum value in an array using a loop instead of spread, avoiding the call stack overfl | | `@helpers4/array` | `minBy` | Returns the element of an array with the smallest derived key, computed by `keyFn`. Unlike min, whic | | `@helpers4/array` | `partition` | Splits an array into two groups based on a predicate function. The first group contains elements for | | `@helpers4/array` | `percentile` | Calculates the p-th percentile of an array of numbers using linear interpolation between the closest | | `@helpers4/array` | `range` | Generates an array of sequential numbers from start to end (exclusive). If only one argument is prov | | `@helpers4/array` | `replaceOrAppend` | Returns a new array with the first item matching `predicate` replaced by `item` — or `item` appended | | `@helpers4/array` | `reverseSortFn` | Reverses the order of a sort function: `reverseSortFn(fn)(a, b)` is `fn(b, a)`. Gives a descending | | `@helpers4/array` | `sample` | Picks one or more random elements from an array. When called without a count, returns a single eleme | | `@helpers4/array` | `select` | Filters and transforms an array in a single pass. Similar to `.filter(condition).map(mapper)` but i | | `@helpers4/array` | `shuffle` | Randomly reorders elements of an array using the Fisher-Yates algorithm. Returns a new array without | | `@helpers4/array` | `sortNumberAscFn` | Sort numbers in ascending order | | `@helpers4/array` | `sortNumberDescFn` | Sort numbers in descending order | | `@helpers4/array` | `sortStringAscFn` | Sort strings in ascending order | | `@helpers4/array` | `sortStringAscInsensitiveFn` | Sort strings in ascending order (case insensitive) | | `@helpers4/array` | `sortStringDescFn` | Sort strings in descending order | | `@helpers4/array` | `sortStringNaturalAscFn` | Sort strings in ascending order using natural (human-friendly) ordering. Numbers embedded in strings | | `@helpers4/array` | `sortStringNaturalAscInsensitiveFn` | Sort strings in ascending natural order, ignoring case **and diacritics** (`Intl.Collator { sensitiv | | `@helpers4/array` | `sortStringNaturalDescFn` | Sort strings in descending order using natural (human-friendly) ordering. Numbers embedded in string | | `@helpers4/array` | `sortStringNaturalDescInsensitiveFn` | Sort strings in descending natural order, ignoring case **and diacritics** (`Intl.Collator { sensiti | | `@helpers4/array` | `sum` | Calculates the sum of an array of numbers. `null` and `undefined` are treated as empty arrays and re | | `@helpers4/array` | `sumBy` | Calculates the sum of numbers derived from each item of an array via an iteratee. `null` and `undefi | | `@helpers4/array` | `symmetricDifference` | Returns the symmetric difference between two arrays: items present in exactly one of the two arrays | | `@helpers4/array` | `toggle` | Returns a new array with `item` removed if present, or appended if absent — the common "toggle a sel | | `@helpers4/array` | `unique` | Removes duplicate values from an array. `null` and `undefined` are treated as empty arrays and retur | | `@helpers4/array` | `uniqueBy` | Removes duplicate items from an array, using a derived key instead of value equality. Unlike unique, | | `@helpers4/array` | `unzip` | Splits an array of tuples into separate arrays, one per position. The inverse of zip. | | `@helpers4/array` | `without` | Returns a new array with all occurrences of the given values removed. Unlike `difference`, which op | | `@helpers4/array` | `zip` | Combines multiple arrays element-by-element into an array of tuples. The result length equals the le | | `@helpers4/binary` | `createByteReader` | Creates a cursor over bytes, for decoding binary formats: fixed-size integers and floats, LEB128 var | | `@helpers4/binary` | `createByteWriter` | Creates a growable buffer to encode binary formats: the counterpart of createByteReader, with the sa | | `@helpers4/binary` | `mediaTypeOf` | Finds the media type of an image from its first bytes (its magic number), whatever its name says: PN | | `@helpers4/binary` | `mediaTypeOfPath` | Finds the media type of a file from the extension of its path or URL: images, fonts, web documents, | | `@helpers4/binary` | `toHex` | Writes bytes as lowercase hexadecimal, two digits per byte. For content keys, hashes and debugging o | | `@helpers4/binary` | `zigzagDecode` | The inverse of zigzagEncode: maps an unsigned 64-bit zigzag value back to the signed integer. | | `@helpers4/binary` | `zigzagEncode` | Maps a signed 64-bit integer to an unsigned one so that values near zero stay small (`0, -1, 1, -2` | | `@helpers4/browser` | `createFileStore` | Creates a file store on a named Cache API cache: keep a computed set of files (a bake, a download, e | | `@helpers4/browser` | `decodeImage` | Loads an image and waits until it is decoded, so it can be painted without a flash or a decoding pau | | `@helpers4/browser` | `loadFont` | Loads a font and registers it in `document.fonts`, so CSS and canvas can use `family` right away. ` | | `@helpers4/browser` | `matchesMedia` | Whether the document currently matches a CSS media query. Outside a browser (no `matchMedia`, e.g. | | `@helpers4/browser` | `observeIntersection` | Calls `callback` each time `element` enters or leaves the viewport (or `options.root`), with an `Int | | `@helpers4/browser` | `observeResize` | Calls `callback` each time the size of `element` changes, with a `ResizeObserver` dedicated to it. L | | `@helpers4/browser` | `onPointerIntent` | Tells a tap from a drag, and hover from touch, on one element: the pointer-event logic every draggab | | `@helpers4/browser` | `prefersReducedMotion` | Whether the user asked the system to reduce motion (`prefers-reduced-motion: reduce`). Outside a br | | `@helpers4/browser` | `preloadImages` | Loads and decodes several images with decodeImage, a few at a time, with `mapSettled` from `helpers4 | | `@helpers4/browser` | `reflectAttribute` | Defines a property on `element` that is backed by an HTML attribute — what a custom element needs fo | | `@helpers4/browser` | `requestWorker` | Runs one job in a module worker: starts it, posts the request, relays its progress, resolves with it | | `@helpers4/browser` | `sha256Hex` | The SHA-256 digest of some data as a hexadecimal string, optionally cut short: a compact content key | | `@helpers4/browser` | `watchMedia` | Calls `listener` each time a CSS media query starts or stops matching. It is not called with the cu | | `@helpers4/browser` | `whenIdle` | Runs `callback` when the browser is idle, with `requestIdleCallback`, for work that can wait (prefet | | `@helpers4/ci` | `buildStatusTable` | Builds a Markdown table body from a map of job names to CI/CD statuses. Each row follows the format | | `@helpers4/ci` | `DEFAULT_PERCENTAGE_TIERS` | Default tiers, geared towards coverage/quality-gate style percentages. Follows shields.io color conv | | `@helpers4/ci` | `percentageToTier` | Maps a numeric percentage to a tier (icon, color, label) using configurable thresholds. Tiers are m | | `@helpers4/ci` | `statusToBadge` | Maps a CI/CD job status to an inline code badge string. | Status | Badge | |--------|-------| | `su | | `@helpers4/ci` | `statusToIcon` | Maps a CI/CD job status to an emoji icon. | Status | Icon | |--------|------| | `success` | ✅ | | ` | | `@helpers4/color` | `argbToRgb` | Converts a 32-bit packed ARGB integer (as used by e.g. Chromium's `Local State` profile `background_ | | `@helpers4/color` | `blendColors` | Composites a source color over a backdrop with a blend mode, as the browser does for `mix-blend-mode | | `@helpers4/color` | `contrastRatio` | Computes the WCAG 2 contrast ratio between two colors, from 1 (identical) to 21 (black on white). Th | | `@helpers4/color` | `hexToRgb` | Parses a hex color string (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa` — the leading `#` is optional) in | | `@helpers4/color` | `hsbToRgb` | Converts an HSB(A) color (also called HSV), as shown by design tool color pickers, into RGB(A). | | `@helpers4/color` | `hslToCss` | Formats an HSL(A) color as a CSS `hsl()` value, in the modern space-separated syntax. The hue is wr | | `@helpers4/color` | `hslToRgb` | Converts an HSL(A) color into RGB(A). | | `@helpers4/color` | `mixColors` | Mixes two colors in sRGB, as CSS `color-mix(in srgb, color P%, base)` does: `percent`% of `color` an | | `@helpers4/color` | `premultiply` | Multiplies the color channels by the alpha channel (premultiplied alpha), the form compositing and G | | `@helpers4/color` | `relativeLuminance` | Computes the WCAG 2.x relative luminance of a color: the perceived brightness from 0 (black) to 1 (w | | `@helpers4/color` | `rgbToCss` | Formats an RGB(A) color as a CSS `rgb()` value, in the modern space-separated syntax that every curr | | `@helpers4/color` | `rgbToHex` | Converts an RGB(A) color into a hex color string. `r`/`g`/`b` are clamped to 0-255 and rounded to t | | `@helpers4/color` | `rgbToHsb` | Converts an RGB(A) color into HSB(A), the model design tools (Figma, Sketch, XD) show in their color | | `@helpers4/color` | `rgbToHsl` | Converts an RGB(A) color into HSL(A). `h`/`s`/`l` are rounded to 1 decimal place to avoid floating- | | `@helpers4/color` | `rgbToUnit` | Converts an RgbColor (channels from `0` to `255`) into a color whose channels are floats from `0` to | | `@helpers4/color` | `unitToRgb` | Converts a color whose channels are floats from `0` to `1` (as Figma, Sketch and Penpot store them) | | `@helpers4/color` | `unpremultiply` | Divides the color channels by the alpha channel: the inverse of premultiply. A fully transparent col | | `@helpers4/commit` | `analyzeCommits` | Analyses a list of commits to suggest a semantic version bump. Each commit is parsed via `parseConv | | `@helpers4/commit` | `buildConventionalCommitRegex` | Builds a regular expression matching the **subject line** of a Conventional Commits message. The re | | `@helpers4/commit` | `isConventionalCommit` | Checks whether a commit message's subject line follows the Conventional Commits format constrained b | | `@helpers4/commit` | `parseConventionalCommit` | Parses a Conventional Commits message into a structured object. The first line is matched against t | | `@helpers4/date` | `addDays` | Adds days to a date. Returns a **new** `Date` — the original is never mutated. Returns `null` if th | | `@helpers4/date` | `addMonths` | Adds months to a date. Returns a **new** `Date` — the original is never mutated. When the resulting | | `@helpers4/date` | `addYears` | Adds years to a date. Returns a **new** `Date` — the original is never mutated. Returns `null` if t | | `@helpers4/date` | `clampDate` | Clamps a date to a [min, max] range. Returns a **new** `Date` — the original is never mutated. Retu | | `@helpers4/date` | `compare` | Comparison of two dates. Accepts any DateLike input (Date, timestamp, or date string). | | `@helpers4/date` | `daysInMonth` | Returns the number of days in the given month of the given year. Month is **1-based** (1 = January, | | `@helpers4/date` | `difference` | Calculates the difference between two dates in the specified unit. Accepts any DateLike input (Date | | `@helpers4/date` | `eachDay` | Returns an array of `Date` objects for each day from `start` to `end` (inclusive). Both boundaries | | `@helpers4/date` | `eachMonth` | Returns an array of `Date` objects for the first day of each month from `start` to `end` (inclusive) | | `@helpers4/date` | `endOf` | Returns a new `Date` set to the **end** of the given unit. - `'day'` — 23:59:59.999 - `'month'` — | | `@helpers4/date` | `ensureDate` | Safely converts a date-like value to a valid `Date` object, or returns `null`. Accepts `Date`, time | | `@helpers4/date` | `format` | Formats a date as a short label that does not depend on the machine: UTC, English, and `Jul 27, 2026 | | `@helpers4/date` | `formatDuration` | Formats a duration in milliseconds as a compact human-readable string. Produces output like `"1h 23 | | `@helpers4/date` | `formatInTimezone` | Formats a date in a specific IANA timezone using `Intl.DateTimeFormat`. Returns `null` if the date | | `@helpers4/date` | `formatPartial` | Formats a partial ISO date at the precision it was given, in UTC: a year alone is approximate and re | | `@helpers4/date` | `fromMillis` | Creates a `Date` from a timestamp in **milliseconds**. Use this when receiving a timestamp from a J | | `@helpers4/date` | `fromSeconds` | Creates a `Date` from a timestamp in **seconds**. Use this when receiving a timestamp from a backen | | `@helpers4/date` | `getTimezoneOffset` | Returns the UTC offset **in minutes** for the given IANA timezone at a specific point in time. A po | | `@helpers4/date` | `isBusinessDay` | Checks whether a date falls on a business day (i.e. **not** a weekend day). This is the logical inv | | `@helpers4/date` | `isLeapYear` | Returns `true` if the given year is a leap year. A year is a leap year when it is divisible by 4, * | | `@helpers4/date` | `isoWeek` | ISO 8601 week of a date: weeks start on Monday and week 1 is the one that contains the first Thursda | | `@helpers4/date` | `isSameDay` | Checks if two dates are the same day. Accepts any DateLike input (Date, timestamp, or date string). | | `@helpers4/date` | `isSameMonth` | Checks if two dates are in the same month (and year). Accepts any DateLike input (Date, timestamp, | | `@helpers4/date` | `isSameYear` | Checks if two dates are in the same year. Accepts any DateLike input (Date, timestamp, or date stri | | `@helpers4/date` | `isTimestampInSeconds` | Checks if a timestamp is likely in seconds (Java/Unix style) vs milliseconds (JavaScript style) | | `@helpers4/date` | `isValid` | Checks if a value is a valid Date instance (not `Invalid Date`). Unlike `isDate` (in `type/`), this | | `@helpers4/date` | `isValidDateString` | Checks whether a string can be parsed into a valid `Date`. Uses the native `Date` constructor. Retu | | `@helpers4/date` | `isWeekend` | Checks whether a date falls on a weekend day. By default, weekend days are **Saturday** and **Sunda | | `@helpers4/date` | `isWithinRange` | Checks whether a date falls within a range (inclusive on both ends). Returns `false` if any of the | | `@helpers4/date` | `listTimezones` | Returns the list of IANA timezone identifiers supported by the runtime. Wraps `Intl.supportedValues | | `@helpers4/date` | `normalizeTimestamp` | Converts a timestamp to JavaScript milliseconds format | | `@helpers4/date` | `overlaps` | Checks whether two date ranges overlap. Two ranges overlap when `rangeA.start <= rangeB.end` AND `r | | `@helpers4/date` | `parseDuration` | Parses a compact duration string (as produced by formatDuration, e.g. `"1h 23m 45s"`) back into mill | | `@helpers4/date` | `parsePartial` | Parses an ISO date that may only be known to the year or the month: `YYYY`, `YYYY-MM` or `YYYY-MM-DD | | `@helpers4/date` | `startOf` | Returns a new `Date` set to the **start** of the given unit. - `'day'` — 00:00:00.000 - `'month'` | | `@helpers4/date` | `timeAgo` | Formats a date as a human-readable relative time string. Uses `Intl.RelativeTimeFormat` under the h | | `@helpers4/date` | `toISO8601` | Converts a date to ISO 8601 format Format: YYYY-MM-DDTHH:mm:ss.sssZ | | `@helpers4/date` | `toMillis` | Converts a date to a timestamp in **milliseconds** (epoch millis). Use this when you need a plain n | | `@helpers4/date` | `toRFC2822` | Converts a date to RFC 2822 format Format: Day, DD Mon YYYY HH:mm:ss +0000 Used in email headers (Da | | `@helpers4/date` | `toRFC3339` | Converts a date to RFC 3339 format Format: YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss+HH:mm RFC 333 | | `@helpers4/date` | `toSeconds` | Converts a date to a timestamp in **seconds** (epoch seconds). Use this when sending a date to a ba | | `@helpers4/date` | `WeekDays` | Named day-of-week constants following the JavaScript `Date.getDay()` convention. Use these instead o | | `@helpers4/fetch` | `fetchJson` | Fetches a URL and returns its parsed JSON body, retrying transient failures. Retried: network error | | `@helpers4/fetch` | `fetchOrThrow` | Wraps `fetch` so that a non-2xx response rejects with an HttpError, instead of resolving like any ot | | `@helpers4/fetch` | `safeFetch` | Wraps `fetch` with built-in error handling: returns `null` when the request fails (network error, no | | `@helpers4/font` | `pickClosest` | Picks the face that CSS would use for a request, among the faces of one family: the CSS Fonts Level | | `@helpers4/function` | `compose` | Composes functions right-to-left: `compose(f, g)(x)` is equivalent to `f(g(x))`. The inverse of pip | | `@helpers4/function` | `createCachedResolver` | Creates a lazy, cached resolver: `resolve(key)` computes and caches `compute(key)` the first time a | | `@helpers4/function` | `curry` | Transforms a multi-argument function into a chain of single-argument functions (Haskell-style curryi | | `@helpers4/function` | `debounce` | Creates a debounced function that delays invoking func until after delay milliseconds have elapsed s | | `@helpers4/function` | `flip` | Creates a function that invokes `fn` with the first two arguments swapped. Useful when adapting a f | | `@helpers4/function` | `identity` | Returns the given value unchanged Useful as a default transform, in function composition, or as a p | | `@helpers4/function` | `memoize` | Returns a memoized version of the function that caches results. Cache keys are derived via `JSON.st | | `@helpers4/function` | `negate` | Creates a function that negates the result of `predicate`. | | `@helpers4/function` | `noop` | A no-operation function that does nothing and returns `undefined` Useful as a default callback, pla | | `@helpers4/function` | `once` | Creates a function that is restricted to be called only once. Subsequent calls return the cached res | | `@helpers4/function` | `partial` | Partially applies arguments to a function, returning a new function that accepts the remaining argum | | `@helpers4/function` | `pipe` | Composes functions left-to-right: the output of each function is passed as input to the next. The i | | `@helpers4/function` | `returnOrThrowError` | Return a value or throw an error if null or undefined. | | `@helpers4/function` | `throttle` | Creates a throttled function that only invokes func at most once per every wait milliseconds Call ` | | `@helpers4/function` | `unary` | Creates a function that calls `fn` with only its first argument, discarding any others. Prevents th | | `@helpers4/geography` | `distance` | Great-circle distance between two WGS84 points, in kilometres (haversine formula, mean Earth radius | | `@helpers4/geography` | `isWithinDistance` | Whether a point lies within a radius of a center, the border included. | | `@helpers4/geometry` | `applyToPoint` | Transforms a point by a matrix. | | `@helpers4/geometry` | `applyToRect` | Transforms a rectangle by a matrix and returns its bounding box: the smallest axis-aligned rectangle | | `@helpers4/geometry` | `contains` | Whether a point or a rectangle is inside a rectangle. For a point (hit-testing), the left and top e | | `@helpers4/geometry` | `ellipsePath` | The path of the ellipse that fills a box, as SVG path data: two half-turn arcs. A square box gives a | | `@helpers4/geometry` | `fit` | Places content in a box like CSS `object-fit` and `object-position`, e.g. to show a design frame in | | `@helpers4/geometry` | `fitContain` | Places content in a box, as large as possible while staying entirely inside the box (CSS `object-fit | | `@helpers4/geometry` | `fitCover` | Places content in a box, as small as possible while covering the whole box (CSS `object-fit: cover`) | | `@helpers4/geometry` | `fitFill` | Places content in a box, stretched to the box on each axis, without keeping its proportions (CSS `ob | | `@helpers4/geometry` | `fitNone` | Places content in a box, at its own size, only positioned (CSS `object-fit: none`). Shortcut for `fi | | `@helpers4/geometry` | `fitScaleDown` | Places content in a box, like fitContain, but never enlarged (CSS `object-fit: scale-down`). Shortcu | | `@helpers4/geometry` | `formatPath` | Writes path commands back as SVG path data: letters and numbers separated by single spaces, numbers | | `@helpers4/geometry` | `identity` | The matrix that changes nothing. | | `@helpers4/geometry` | `intersection` | The area two rectangles have in common. Rectangles that only touch (along an edge or at a corner) h | | `@helpers4/geometry` | `intersects` | Whether two rectangles have an area in common, exactly when intersection returns a rectangle: rectan | | `@helpers4/geometry` | `invert` | The matrix that undoes `m`, e.g. to turn a pointer position on screen back into the coordinates of a | | `@helpers4/geometry` | `matrixToCss` | Writes a matrix as a CSS `transform` or SVG `transform` value. Entries are written as JavaScript pr | | `@helpers4/geometry` | `multiply` | Multiplies matrices, in the mathematical order: the last one applies first. It is the order of a CSS | | `@helpers4/geometry` | `parsePath` | Parses SVG path data (the `d` attribute) into commands, as written: the letters keep their case (abs | | `@helpers4/geometry` | `rectToRect` | The translation and scale that put one rectangle exactly on another, for animating or fitting betwee | | `@helpers4/geometry` | `rotate` | A matrix that rotates points around the origin. With the y axis pointing down (screen, CSS, SVG), a | | `@helpers4/geometry` | `roundedRectPath` | The path of a rectangle with a radius per corner, as SVG path data. Each radius is clamped to half t | | `@helpers4/geometry` | `scale` | A matrix that scales points from the origin. | | `@helpers4/geometry` | `simplifyPolyline` | Removes the points of a polyline that change its shape by less than `tolerance`, with the Ramer–Doug | | `@helpers4/geometry` | `transformPath` | Transforms SVG path data by a matrix. The result is written with absolute `M`, `L`, `C`, `Q` and `Z` | | `@helpers4/geometry` | `translate` | A matrix that moves points by `(tx, ty)`. | | `@helpers4/geometry` | `union` | The smallest rectangle that contains all the given rectangles, e.g. the bounds of a group of layers. | | `@helpers4/guard` | `isArray` | Checks if a value is an array. | | `@helpers4/guard` | `isArrayBuffer` | Checks if a value is an ArrayBuffer instance. Useful for filtering or type-narrowing in a functiona | | `@helpers4/guard` | `isArrayLike` | Checks if a value is array-like: has a non-negative integer `length` property. Returns `true` for a | | `@helpers4/guard` | `isAsyncFunction` | Checks if a value is an async function. Returns `true` for any function declared with `async`. | | `@helpers4/guard` | `isAsyncGenerator` | Checks if a value is an async generator object (the result of calling an `async function*`). Distin | | `@helpers4/guard` | `isAsyncGeneratorFunction` | Checks if a value is an async generator function (an `async function*` declaration or expression). | | `@helpers4/guard` | `isAsyncIterable` | Checks if a value implements the async iterable protocol. Returns `true` for any object that has a | | `@helpers4/guard` | `isBigInt` | Checks if a value is a bigint. | | `@helpers4/guard` | `isBlob` | Checks if a value is a Blob instance. Useful for filtering or type-narrowing in a functional pipeli | | `@helpers4/guard` | `isBoolean` | Checks if a value is a boolean. | | `@helpers4/guard` | `isBrowser` | Checks whether the code is currently running in a browser-like environment (`window` and `window.doc | | `@helpers4/guard` | `isCanonicalJson` | Checks whether a value is a string that is already canonical JSON (RFC 8785, JSON Canonicalization S | | `@helpers4/guard` | `isCssColor` | Checks whether a value is a syntactically-safe, plain CSS color: a hex color (`#rgb`, `#rgba`, `#rrg | | `@helpers4/guard` | `isDate` | Checks if a value is a Date instance. Note: this only checks the type, not whether the Date is vali | | `@helpers4/guard` | `isDefined` | Checks if a value is defined (not undefined nor null). This is the inverse of isNullish. Use as a t | | `@helpers4/guard` | `isError` | Checks if a value is an Error instance. | | `@helpers4/guard` | `isFalsy` | Checks if a value is falsy (`false`, `null`, `undefined`, `0`, `""`, `NaN`). | | `@helpers4/guard` | `isFormData` | Checks if a value is a FormData instance. Useful for filtering or type-narrowing in a functional pi | | `@helpers4/guard` | `isFunction` | Checks if a value is a function. | | `@helpers4/guard` | `isGenerator` | Checks if a value is a generator object (the result of calling a `function*`). Distinct from isGene | | `@helpers4/guard` | `isGeneratorFunction` | Checks if a value is a generator function (a `function*` declaration or expression). Distinct from | | `@helpers4/guard` | `isHostname` | Checks whether a value is a syntactically valid DNS hostname (RFC 952, RFC 1123, RFC 3696 section 2) | | `@helpers4/guard` | `isIJson` | Checks whether a value is a string holding I-JSON (RFC 7493, the Internet JSON message format): stri | | `@helpers4/guard` | `isIterable` | Checks if a value is iterable (has a `Symbol.iterator` method). Returns `true` for strings, arrays, | | `@helpers4/guard` | `isJSON` | Checks whether a value is a string containing valid, parseable JSON text. Distinct from isJSONValue | | `@helpers4/guard` | `isJson5` | Checks whether a value is a string holding valid JSON5 (JSON5 1.0.0) — JSON with comments, trailing | | `@helpers4/guard` | `isJSONArray` | Checks whether a value is an array whose every element is a valid JSON value (see isJSONValue). | | `@helpers4/guard` | `isJsonc` | Checks whether a value is a string holding valid JSONC — JSON with comments and trailing commas, the | | `@helpers4/guard` | `isJSONObject` | Checks whether a value is a plain object whose every own value is a valid JSON value (see isJSONValu | | `@helpers4/guard` | `isJsonSequence` | Checks whether a value is a string holding a valid JSON text sequence (RFC 7464, `application/json-s | | `@helpers4/guard` | `isJSONValue` | Checks whether a value is composed entirely of JSON-representable types: `string`, finite `number`, | | `@helpers4/guard` | `isLength` | Checks whether a value is a valid array-like `length`: a non-negative safe integer (`0 <= value <= N | | `@helpers4/guard` | `isMap` | Checks if a value is a Map instance. | | `@helpers4/guard` | `isNdjson` | Checks whether a value is a string holding valid newline-delimited JSON — one strict JSON value per | | `@helpers4/guard` | `isNode` | Checks whether the code is currently running in a Node.js-like environment (`process.versions.node` | | `@helpers4/guard` | `isNull` | Checks if a value is `null`. | | `@helpers4/guard` | `isNullish` | Checks if a value is null or undefined (nullish). | | `@helpers4/guard` | `isNumber` | Checks if a value is a number. Returns `false` for `NaN`, which intentionally deviates from `typeof | | `@helpers4/guard` | `isPlainObject` | Checks if a value is a plain object. A plain object is created by `{}`, `new Object()`, or `Object. | | `@helpers4/guard` | `isPrimitive` | Checks if a value is a JavaScript primitive. Primitive types: `string`, `number`, `boolean`, `bigin | | `@helpers4/guard` | `isPromise` | Checks if a value is a Promise or a thenable. Returns `true` for any object that has `.then()` and | | `@helpers4/guard` | `isPromiseLike` | Checks if a value is a thenable (has a `.then()` method). Looser than isPromise: accepts any object | | `@helpers4/guard` | `isPropertyKey` | Checks if a value is a valid property key: `string`, `number`, or `symbol`. | | `@helpers4/guard` | `isRegExp` | Checks if a value is a RegExp instance. | | `@helpers4/guard` | `isSet` | Checks if a value is a Set instance. | | `@helpers4/guard` | `isSpecialObject` | Determines if a value is a special object that should not have its properties compared deeply. Speci | | `@helpers4/guard` | `isString` | Checks if a value is a string. | | `@helpers4/guard` | `isSymbol` | Checks if a value is a symbol. | | `@helpers4/guard` | `isTemporalDuration` | Checks if a value is a `Temporal.Duration`. Uses `instanceof` when `Temporal` is available globally | | `@helpers4/guard` | `isTemporalInstant` | Checks if a value is a `Temporal.Instant`. Uses `instanceof` when `Temporal` is available globally, | | `@helpers4/guard` | `isTemporalPlainDate` | Checks if a value is a `Temporal.PlainDate`. Uses `instanceof` when `Temporal` is available globall | | `@helpers4/guard` | `isTemporalPlainDateTime` | Checks if a value is a `Temporal.PlainDateTime`. Uses `instanceof` when `Temporal` is available glo | | `@helpers4/guard` | `isTemporalPlainTime` | Checks if a value is a `Temporal.PlainTime`. Uses `instanceof` when `Temporal` is available globall | | `@helpers4/guard` | `isTemporalZonedDateTime` | Checks if a value is a `Temporal.ZonedDateTime`. Uses `instanceof` when `Temporal` is available glo | | `@helpers4/guard` | `isTimestamp` | Checks if a value is a valid timestamp (milliseconds or Unix seconds). Supports: - JavaScript / Jav | | `@helpers4/guard` | `isTruthy` | Checks if a value is truthy (not `false`, `null`, `undefined`, `0`, `""`, or `NaN`). This is the ty | | `@helpers4/guard` | `isUndefined` | Checks if a value is `undefined`. | | `@helpers4/guard` | `isValidRegex` | Checks if a string is a valid regex pattern. | | `@helpers4/guard` | `isWeakMap` | Checks if a value is a WeakMap instance. | | `@helpers4/guard` | `isWeakMapKey` | Checks whether a value can be used as a key in a `WeakMap` (or a `WeakSet` member / `WeakRef` target | | `@helpers4/guard` | `isWeakSet` | Checks if a value is a WeakSet instance. | | `@helpers4/id` | `uuid7` | Generates a UUID v7 string (RFC 9562). UUID v7 embeds a Unix timestamp in milliseconds, making it ch | | `@helpers4/json` | `parse` | Parses JSON permissively: strict JSON, JSONC (the dialect of `tsconfig.json` and VS Code's `settings | | `@helpers4/json` | `parseLines` | Parses newline-delimited JSON — one JSON value per line. Covers both NDJSON (`application/x-ndjson`, | | `@helpers4/json` | `parseSequence` | Parses a JSON text sequence (RFC 7464, `application/json-seq`): records that each start with the ASC | | `@helpers4/json` | `parseStrict` | Parses strict JSON (RFC 8259) — exactly what `JSON.parse` accepts, nothing more. **Accepts:** stand | | `@helpers4/json` | `safeParse` | Parses JSON permissively like parse — strict JSON, JSONC (HuJSON, JWCC) and JSON5 — but returns `nul | | `@helpers4/json` | `safeParseLines` | Parses newline-delimited JSON (NDJSON, JSON Lines) like parseLines, but returns `null` (or `fallback | | `@helpers4/json` | `safeParseSequence` | Parses a JSON text sequence (RFC 7464) like parseSequence, but returns `null` (or `fallback`) instea | | `@helpers4/json` | `safeParseStrict` | Parses strict JSON like parseStrict, but returns `null` (or `fallback`) instead of throwing on inval | | `@helpers4/json` | `stringify` | Serializes a value to JSON text — pretty-printed with 2 spaces by default, or canonical. **Formatti | | `@helpers4/json` | `stringifyForHtml` | Serializes a value to compact JSON that is safe to inline in an HTML page, typically in a ``), open a comment (`