Skip to content

Regira Extensions (front-end)

@regira/modules/extensions — opt-in prototype extensions for Array, Date, and Promise. Nothing is patched on import; each is enabled explicitly via a use() method, so the app decides when (and whether) to touch globals. The array and promise helpers wrap @regira/modules/utilities.

What it provides

ExportPurpose
default (useArrayExtensions, useDateExtensions, usePromiseExtensions)Convenience enablers for the three prototype extensions.
arrayExtensionsuse(overwrite?) / injectInto(target, overwrite?) — adds array-utility helpers (orderBy, groupBy, distinct, sum, …) onto Array.prototype.
dateExtensionsuse() — overrides Date.prototype.toJSON with stringifyDate (local time, no UTC correction).
promiseExtensionsuse() — adds static Promise.debounce(func, wait?) and Promise.enqueue(arr).

How it fits

extensions.useArrayExtensions()   →  Array.prototype gains orderBy/groupBy/sum/… (via array-utility)
extensions.useDateExtensions()    →  Date.prototype.toJSON serializes local wall-clock (via datetime-utility)
extensions.usePromiseExtensions() →  Promise.debounce / Promise.enqueue (via promise-utility)

Call the enablers once at startup, before code relies on the new prototype members. Array injection skips members that already exist unless overwrite is true.