@vielzeug/toolkit 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array/{sortBy.cjs → arrange.cjs} +2 -2
- package/dist/array/arrange.cjs.map +1 -0
- package/dist/array/arrange.js +6 -0
- package/dist/array/arrange.js.map +1 -0
- package/dist/array/chunk.cjs +1 -1
- package/dist/array/chunk.cjs.map +1 -1
- package/dist/array/chunk.js +15 -12
- package/dist/array/chunk.js.map +1 -1
- package/dist/array/group.cjs +1 -1
- package/dist/array/group.cjs.map +1 -1
- package/dist/array/group.js +9 -9
- package/dist/array/group.js.map +1 -1
- package/dist/array/list.cjs +1 -1
- package/dist/array/list.cjs.map +1 -1
- package/dist/array/list.js +87 -50
- package/dist/array/list.js.map +1 -1
- package/dist/array/pick.cjs.map +1 -1
- package/dist/array/pick.js.map +1 -1
- package/dist/array/remoteList.cjs +2 -0
- package/dist/array/remoteList.cjs.map +1 -0
- package/dist/array/remoteList.js +123 -0
- package/dist/array/remoteList.js.map +1 -0
- package/dist/date/expires.cjs.map +1 -1
- package/dist/date/expires.js.map +1 -1
- package/dist/date/interval.cjs.map +1 -1
- package/dist/date/interval.js.map +1 -1
- package/dist/date/timeDiff.cjs +1 -1
- package/dist/date/timeDiff.cjs.map +1 -1
- package/dist/date/timeDiff.js +10 -12
- package/dist/date/timeDiff.js.map +1 -1
- package/dist/function/curry.cjs +1 -1
- package/dist/function/curry.cjs.map +1 -1
- package/dist/function/curry.js +3 -3
- package/dist/function/curry.js.map +1 -1
- package/dist/function/debounce.cjs +1 -1
- package/dist/function/debounce.cjs.map +1 -1
- package/dist/function/debounce.js +22 -5
- package/dist/function/debounce.js.map +1 -1
- package/dist/function/memo.cjs +1 -1
- package/dist/function/memo.cjs.map +1 -1
- package/dist/function/memo.js +14 -13
- package/dist/function/memo.js.map +1 -1
- package/dist/function/parallel.cjs +2 -0
- package/dist/function/parallel.cjs.map +1 -0
- package/dist/function/parallel.js +28 -0
- package/dist/function/parallel.js.map +1 -0
- package/dist/function/proxy.cjs.map +1 -1
- package/dist/function/proxy.js.map +1 -1
- package/dist/function/prune.cjs +2 -0
- package/dist/function/prune.cjs.map +1 -0
- package/dist/function/prune.js +30 -0
- package/dist/function/prune.js.map +1 -0
- package/dist/function/retry.cjs +1 -1
- package/dist/function/retry.cjs.map +1 -1
- package/dist/function/retry.js +13 -13
- package/dist/function/retry.js.map +1 -1
- package/dist/function/sleep.cjs +1 -1
- package/dist/function/sleep.cjs.map +1 -1
- package/dist/function/sleep.js +8 -3
- package/dist/function/sleep.js.map +1 -1
- package/dist/function/throttle.cjs +1 -1
- package/dist/function/throttle.cjs.map +1 -1
- package/dist/function/throttle.js +33 -6
- package/dist/function/throttle.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +455 -95
- package/dist/index.js +218 -194
- package/dist/index.js.map +1 -1
- package/dist/math/abs.cjs +2 -0
- package/dist/math/abs.cjs.map +1 -0
- package/dist/math/abs.js +7 -0
- package/dist/math/abs.js.map +1 -0
- package/dist/math/add.cjs +2 -0
- package/dist/math/add.cjs.map +1 -0
- package/dist/math/add.js +9 -0
- package/dist/math/add.js.map +1 -0
- package/dist/math/allocate.cjs +2 -0
- package/dist/math/allocate.cjs.map +1 -0
- package/dist/math/allocate.js +29 -0
- package/dist/math/allocate.js.map +1 -0
- package/dist/math/average.cjs +1 -1
- package/dist/math/average.cjs.map +1 -1
- package/dist/math/average.js +18 -12
- package/dist/math/average.js.map +1 -1
- package/dist/math/distribute.cjs +2 -0
- package/dist/math/distribute.cjs.map +1 -0
- package/dist/math/distribute.js +18 -0
- package/dist/math/distribute.js.map +1 -0
- package/dist/math/divide.cjs +2 -0
- package/dist/math/divide.cjs.map +1 -0
- package/dist/math/divide.js +11 -0
- package/dist/math/divide.js.map +1 -0
- package/dist/math/median.cjs.map +1 -1
- package/dist/math/median.js.map +1 -1
- package/dist/math/multiply.cjs +2 -0
- package/dist/math/multiply.cjs.map +1 -0
- package/dist/math/multiply.js +9 -0
- package/dist/math/multiply.js.map +1 -0
- package/dist/math/range.cjs +1 -1
- package/dist/math/range.cjs.map +1 -1
- package/dist/math/range.js +14 -6
- package/dist/math/range.js.map +1 -1
- package/dist/math/subtract.cjs +2 -0
- package/dist/math/subtract.cjs.map +1 -0
- package/dist/math/subtract.js +9 -0
- package/dist/math/subtract.js.map +1 -0
- package/dist/math/sum.cjs +1 -1
- package/dist/math/sum.cjs.map +1 -1
- package/dist/math/sum.js +11 -18
- package/dist/math/sum.js.map +1 -1
- package/dist/money/currency.cjs +2 -0
- package/dist/money/currency.cjs.map +1 -0
- package/dist/money/currency.js +49 -0
- package/dist/money/currency.js.map +1 -0
- package/dist/money/exchange.cjs +2 -0
- package/dist/money/exchange.cjs.map +1 -0
- package/dist/money/exchange.js +13 -0
- package/dist/money/exchange.js.map +1 -0
- package/dist/object/clone.cjs +1 -1
- package/dist/object/clone.cjs.map +1 -1
- package/dist/object/clone.js +13 -3
- package/dist/object/clone.js.map +1 -1
- package/dist/object/merge.cjs +1 -1
- package/dist/object/merge.cjs.map +1 -1
- package/dist/object/merge.js +11 -15
- package/dist/object/merge.js.map +1 -1
- package/dist/object/parseJSON.cjs.map +1 -1
- package/dist/object/parseJSON.js.map +1 -1
- package/dist/object/path.cjs.map +1 -1
- package/dist/object/path.js.map +1 -1
- package/dist/object/seek.cjs +1 -1
- package/dist/object/seek.cjs.map +1 -1
- package/dist/object/seek.js +8 -6
- package/dist/object/seek.js.map +1 -1
- package/dist/random/uuid.cjs +1 -1
- package/dist/random/uuid.cjs.map +1 -1
- package/dist/random/uuid.js +6 -3
- package/dist/random/uuid.js.map +1 -1
- package/dist/string/camelCase.cjs +1 -1
- package/dist/string/camelCase.cjs.map +1 -1
- package/dist/string/camelCase.js +3 -3
- package/dist/string/camelCase.js.map +1 -1
- package/dist/string/similarity.cjs +1 -1
- package/dist/string/similarity.cjs.map +1 -1
- package/dist/string/similarity.js +24 -21
- package/dist/string/similarity.js.map +1 -1
- package/dist/string/truncate.cjs +1 -1
- package/dist/string/truncate.cjs.map +1 -1
- package/dist/string/truncate.js +14 -5
- package/dist/string/truncate.js.map +1 -1
- package/dist/typed/is.cjs +1 -1
- package/dist/typed/is.cjs.map +1 -1
- package/dist/typed/is.js +30 -31
- package/dist/typed/is.js.map +1 -1
- package/dist/typed/isEmpty.cjs +1 -1
- package/dist/typed/isEmpty.cjs.map +1 -1
- package/dist/typed/isEmpty.js +6 -6
- package/dist/typed/isEmpty.js.map +1 -1
- package/dist/typed/isEqual.cjs +1 -1
- package/dist/typed/isEqual.cjs.map +1 -1
- package/dist/typed/isEqual.js +22 -17
- package/dist/typed/isEqual.js.map +1 -1
- package/package.json +1 -1
- package/dist/array/sortBy.cjs.map +0 -1
- package/dist/array/sortBy.js +0 -6
- package/dist/array/sortBy.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallel.js","sources":["../../src/function/parallel.ts"],"sourcesContent":["/**\n * Processes an array with an async callback with controlled parallelism.\n * Similar to Promise.all, but limits how many items are processed concurrently.\n * Returns an ordered array of results.\n *\n * @example\n * ```ts\n * // Process 3 items at a time\n * const results = await parallel(3, [1, 2, 3, 4, 5], async (n) => {\n * await delay(100);\n * return n * 2;\n * });\n * // [2, 4, 6, 8, 10]\n *\n * // With abort signal\n * const controller = new AbortController();\n * const results = await parallel(2, items, async (item) => {\n * return processItem(item);\n * }, controller.signal);\n * ```\n *\n * @param limit - Maximum number of concurrent operations (must be >= 1)\n * @param array - Array of items to process\n * @param callback - Async function to process each item\n * @param signal - Optional AbortSignal to cancel processing\n * @returns Promise resolving to an ordered array of results\n * @throws {Error} If limit is less than 1\n * @throws {DOMException} If aborted via signal\n */\nexport async function parallel<T, R>(\n limit: number,\n array: T[],\n callback: (item: T, index: number, array: T[]) => Promise<R>,\n signal?: AbortSignal,\n): Promise<R[]> {\n if (limit < 1) {\n throw new Error('Limit must be at least 1');\n }\n\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n\n const results: R[] = new Array(array.length);\n let currentIndex = 0;\n let hasError = false;\n let error: unknown;\n\n // Check for abort\n const checkAbort = () => {\n if (signal?.aborted) {\n hasError = true;\n error = new DOMException('Aborted', 'AbortError');\n return true;\n }\n return false;\n };\n\n // Worker function that processes items from the queue\n const worker = async (): Promise<void> => {\n while (currentIndex < array.length && !hasError) {\n if (checkAbort()) {\n break;\n }\n\n const index = currentIndex++;\n\n try {\n results[index] = await callback(array[index], index, array);\n } catch (err) {\n hasError = true;\n error = err;\n break;\n }\n }\n };\n\n // Create workers up to the limit\n const workers: Promise<void>[] = [];\n const workerCount = Math.min(limit, array.length);\n\n for (let i = 0; i < workerCount; i++) {\n workers.push(worker());\n }\n\n // Wait for all workers to complete\n await Promise.all(workers);\n\n // If there was an error, throw it\n if (hasError) {\n throw error;\n }\n\n return results;\n}\n"],"names":["parallel","limit","array","callback","signal","results","currentIndex","hasError","error","checkAbort","worker","index","err","workers","workerCount","i"],"mappings":"AA6BA,eAAsBA,EACpBC,GACAC,GACAC,GACAC,GACc;AACd,MAAIH,IAAQ;AACV,UAAM,IAAI,MAAM,0BAA0B;AAG5C,MAAIG,GAAQ;AACV,UAAM,IAAI,aAAa,WAAW,YAAY;AAGhD,QAAMC,IAAe,IAAI,MAAMH,EAAM,MAAM;AAC3C,MAAII,IAAe,GACfC,IAAW,IACXC;AAGJ,QAAMC,IAAa,MACbL,GAAQ,WACVG,IAAW,IACXC,IAAQ,IAAI,aAAa,WAAW,YAAY,GACzC,MAEF,IAIHE,IAAS,YAA2B;AACxC,WAAOJ,IAAeJ,EAAM,UAAU,CAACK,KACjC,CAAAE,OAD2C;AAK/C,YAAME,IAAQL;AAEd,UAAI;AACF,QAAAD,EAAQM,CAAK,IAAI,MAAMR,EAASD,EAAMS,CAAK,GAAGA,GAAOT,CAAK;AAAA,MAC5D,SAASU,GAAK;AACZ,QAAAL,IAAW,IACXC,IAAQI;AACR;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAGMC,IAA2B,CAAA,GAC3BC,IAAc,KAAK,IAAIb,GAAOC,EAAM,MAAM;AAEhD,WAASa,IAAI,GAAGA,IAAID,GAAaC;AAC/B,IAAAF,EAAQ,KAAKH,GAAQ;AAOvB,MAHA,MAAM,QAAQ,IAAIG,CAAO,GAGrBN;AACF,UAAMC;AAGR,SAAOH;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.cjs","sources":["../../src/function/proxy.ts"],"sourcesContent":["import { isObject } from '../typed/isObject';\nimport type { Obj } from '../types';\n\ntype ProxyOptions<T> = {\n set?: <K extends PropertyKey>(prop: K, curr: unknown, prev: unknown, target: T) => unknown;\n get?: <K extends PropertyKey>(prop: K, val: unknown, target: T) => unknown;\n deep?: boolean;\n watch?: (keyof T)[];\n};\n\n/**\n * Creates a new Proxy for the given object that invokes functions when properties are accessed or modified.\n\n * @example\n * ```ts\n * const obj = { a: 1, b: 2 };\n * const log = (prop, curr, prev, target) => console.log(`Property '${prop}' changed from ${prev} to ${curr}`);\n * const proxyObj = proxy(obj, { set: log });\n * proxyObj.a = 3; // logs 'Property 'a' changed from 1 to 3'\n * ```\n *\n * @param item - The object to observe.\n * @param options - Configuration options for the proxy.\n * @param [options.set] - A function to call when a property is set. It receives the property name, current value, previous value, and the target object.\n * @param [options.get] - A function to call when a property is accessed. It receives the property name, value, and the target object.\n * @param [options.deep] - If true, the proxy will also apply to nested objects.\n * @param [options.watch] - An array of property names to watch. If provided, only these properties will trigger the set and get functions.\n *\n * @returns A new Proxy for the given object.\n */\nexport function proxy<T extends Obj>(item: T, options: ProxyOptions<T>): T {\n const { set, get, deep = false, watch } = options;\n\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.get(target, prop, receiver);\n }\n\n let value = Reflect.get(target, prop, receiver);\n\n if (get) {\n // biome-ignore lint/suspicious/noExplicitAny: -\n value = get(prop, value, target) as any;\n }\n\n if (deep && isObject(value)) {\n return proxy(value as T[keyof T], options);\n }\n\n return value;\n },\n set(target, prop, val, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.set(target, prop, val, receiver);\n }\n\n const prev = target[prop as keyof T];\n const value = set ? set(prop, val, prev, target) : val;\n\n if (deep && isObject(value)) {\n return Reflect.set(target, prop, proxy(value as T[keyof T], options), receiver);\n }\n\n return Reflect.set(target, prop, value, receiver);\n },\n };\n\n return new Proxy(item, handler);\n}\n"],"names":["proxy","item","options","set","get","deep","watch","handler","target","prop","receiver","value","isObject","val","prev"],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy.cjs","sources":["../../src/function/proxy.ts"],"sourcesContent":["import { isObject } from '../typed/isObject';\nimport type { Obj } from '../types';\n\n// #region ProxyOptions\ntype ProxyOptions<T> = {\n set?: <K extends PropertyKey>(prop: K, curr: unknown, prev: unknown, target: T) => unknown;\n get?: <K extends PropertyKey>(prop: K, val: unknown, target: T) => unknown;\n deep?: boolean;\n watch?: (keyof T)[];\n};\n// #endregion ProxyOptions\n\n/**\n * Creates a new Proxy for the given object that invokes functions when properties are accessed or modified.\n\n * @example\n * ```ts\n * const obj = { a: 1, b: 2 };\n * const log = (prop, curr, prev, target) => console.log(`Property '${prop}' changed from ${prev} to ${curr}`);\n * const proxyObj = proxy(obj, { set: log });\n * proxyObj.a = 3; // logs 'Property 'a' changed from 1 to 3'\n * ```\n *\n * @param item - The object to observe.\n * @param options - Configuration options for the proxy.\n * @param [options.set] - A function to call when a property is set. It receives the property name, current value, previous value, and the target object.\n * @param [options.get] - A function to call when a property is accessed. It receives the property name, value, and the target object.\n * @param [options.deep] - If true, the proxy will also apply to nested objects.\n * @param [options.watch] - An array of property names to watch. If provided, only these properties will trigger the set and get functions.\n *\n * @returns A new Proxy for the given object.\n */\nexport function proxy<T extends Obj>(item: T, options: ProxyOptions<T>): T {\n const { set, get, deep = false, watch } = options;\n\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.get(target, prop, receiver);\n }\n\n let value = Reflect.get(target, prop, receiver);\n\n if (get) {\n // biome-ignore lint/suspicious/noExplicitAny: -\n value = get(prop, value, target) as any;\n }\n\n if (deep && isObject(value)) {\n return proxy(value as T[keyof T], options);\n }\n\n return value;\n },\n set(target, prop, val, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.set(target, prop, val, receiver);\n }\n\n const prev = target[prop as keyof T];\n const value = set ? set(prop, val, prev, target) : val;\n\n if (deep && isObject(value)) {\n return Reflect.set(target, prop, proxy(value as T[keyof T], options), receiver);\n }\n\n return Reflect.set(target, prop, value, receiver);\n },\n };\n\n return new Proxy(item, handler);\n}\n"],"names":["proxy","item","options","set","get","deep","watch","handler","target","prop","receiver","value","isObject","val","prev"],"mappings":"yHAgCO,SAASA,EAAqBC,EAASC,EAA6B,CACzE,KAAM,CAAE,IAAAC,EAAK,IAAAC,EAAK,KAAAC,EAAO,GAAO,MAAAC,GAAUJ,EAEpCK,EAA2B,CAC/B,IAAIC,EAAQC,EAAMC,EAAU,CAC1B,GAAIJ,GAAS,CAACA,EAAM,SAASG,CAAe,EAC1C,OAAO,QAAQ,IAAID,EAAQC,EAAMC,CAAQ,EAG3C,IAAIC,EAAQ,QAAQ,IAAIH,EAAQC,EAAMC,CAAQ,EAO9C,OALIN,IAEFO,EAAQP,EAAIK,EAAME,EAAOH,CAAM,GAG7BH,GAAQO,WAASD,CAAK,EACjBX,EAAMW,EAAqBT,CAAO,EAGpCS,CACT,EACA,IAAIH,EAAQC,EAAMI,EAAKH,EAAU,CAC/B,GAAIJ,GAAS,CAACA,EAAM,SAASG,CAAe,EAC1C,OAAO,QAAQ,IAAID,EAAQC,EAAMI,EAAKH,CAAQ,EAGhD,MAAMI,EAAON,EAAOC,CAAe,EAC7BE,EAAQR,EAAMA,EAAIM,EAAMI,EAAKC,EAAMN,CAAM,EAAIK,EAEnD,OAAIR,GAAQO,WAASD,CAAK,EACjB,QAAQ,IAAIH,EAAQC,EAAMT,EAAMW,EAAqBT,CAAO,EAAGQ,CAAQ,EAGzE,QAAQ,IAAIF,EAAQC,EAAME,EAAOD,CAAQ,CAClD,CAAA,EAGF,OAAO,IAAI,MAAMT,EAAMM,CAAO,CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sources":["../../src/function/proxy.ts"],"sourcesContent":["import { isObject } from '../typed/isObject';\nimport type { Obj } from '../types';\n\ntype ProxyOptions<T> = {\n set?: <K extends PropertyKey>(prop: K, curr: unknown, prev: unknown, target: T) => unknown;\n get?: <K extends PropertyKey>(prop: K, val: unknown, target: T) => unknown;\n deep?: boolean;\n watch?: (keyof T)[];\n};\n\n/**\n * Creates a new Proxy for the given object that invokes functions when properties are accessed or modified.\n\n * @example\n * ```ts\n * const obj = { a: 1, b: 2 };\n * const log = (prop, curr, prev, target) => console.log(`Property '${prop}' changed from ${prev} to ${curr}`);\n * const proxyObj = proxy(obj, { set: log });\n * proxyObj.a = 3; // logs 'Property 'a' changed from 1 to 3'\n * ```\n *\n * @param item - The object to observe.\n * @param options - Configuration options for the proxy.\n * @param [options.set] - A function to call when a property is set. It receives the property name, current value, previous value, and the target object.\n * @param [options.get] - A function to call when a property is accessed. It receives the property name, value, and the target object.\n * @param [options.deep] - If true, the proxy will also apply to nested objects.\n * @param [options.watch] - An array of property names to watch. If provided, only these properties will trigger the set and get functions.\n *\n * @returns A new Proxy for the given object.\n */\nexport function proxy<T extends Obj>(item: T, options: ProxyOptions<T>): T {\n const { set, get, deep = false, watch } = options;\n\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.get(target, prop, receiver);\n }\n\n let value = Reflect.get(target, prop, receiver);\n\n if (get) {\n // biome-ignore lint/suspicious/noExplicitAny: -\n value = get(prop, value, target) as any;\n }\n\n if (deep && isObject(value)) {\n return proxy(value as T[keyof T], options);\n }\n\n return value;\n },\n set(target, prop, val, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.set(target, prop, val, receiver);\n }\n\n const prev = target[prop as keyof T];\n const value = set ? set(prop, val, prev, target) : val;\n\n if (deep && isObject(value)) {\n return Reflect.set(target, prop, proxy(value as T[keyof T], options), receiver);\n }\n\n return Reflect.set(target, prop, value, receiver);\n },\n };\n\n return new Proxy(item, handler);\n}\n"],"names":["proxy","item","options","set","get","deep","watch","handler","target","prop","receiver","value","isObject","val","prev"],"mappings":";
|
|
1
|
+
{"version":3,"file":"proxy.js","sources":["../../src/function/proxy.ts"],"sourcesContent":["import { isObject } from '../typed/isObject';\nimport type { Obj } from '../types';\n\n// #region ProxyOptions\ntype ProxyOptions<T> = {\n set?: <K extends PropertyKey>(prop: K, curr: unknown, prev: unknown, target: T) => unknown;\n get?: <K extends PropertyKey>(prop: K, val: unknown, target: T) => unknown;\n deep?: boolean;\n watch?: (keyof T)[];\n};\n// #endregion ProxyOptions\n\n/**\n * Creates a new Proxy for the given object that invokes functions when properties are accessed or modified.\n\n * @example\n * ```ts\n * const obj = { a: 1, b: 2 };\n * const log = (prop, curr, prev, target) => console.log(`Property '${prop}' changed from ${prev} to ${curr}`);\n * const proxyObj = proxy(obj, { set: log });\n * proxyObj.a = 3; // logs 'Property 'a' changed from 1 to 3'\n * ```\n *\n * @param item - The object to observe.\n * @param options - Configuration options for the proxy.\n * @param [options.set] - A function to call when a property is set. It receives the property name, current value, previous value, and the target object.\n * @param [options.get] - A function to call when a property is accessed. It receives the property name, value, and the target object.\n * @param [options.deep] - If true, the proxy will also apply to nested objects.\n * @param [options.watch] - An array of property names to watch. If provided, only these properties will trigger the set and get functions.\n *\n * @returns A new Proxy for the given object.\n */\nexport function proxy<T extends Obj>(item: T, options: ProxyOptions<T>): T {\n const { set, get, deep = false, watch } = options;\n\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.get(target, prop, receiver);\n }\n\n let value = Reflect.get(target, prop, receiver);\n\n if (get) {\n // biome-ignore lint/suspicious/noExplicitAny: -\n value = get(prop, value, target) as any;\n }\n\n if (deep && isObject(value)) {\n return proxy(value as T[keyof T], options);\n }\n\n return value;\n },\n set(target, prop, val, receiver) {\n if (watch && !watch.includes(prop as keyof T)) {\n return Reflect.set(target, prop, val, receiver);\n }\n\n const prev = target[prop as keyof T];\n const value = set ? set(prop, val, prev, target) : val;\n\n if (deep && isObject(value)) {\n return Reflect.set(target, prop, proxy(value as T[keyof T], options), receiver);\n }\n\n return Reflect.set(target, prop, value, receiver);\n },\n };\n\n return new Proxy(item, handler);\n}\n"],"names":["proxy","item","options","set","get","deep","watch","handler","target","prop","receiver","value","isObject","val","prev"],"mappings":";AAgCO,SAASA,EAAqBC,GAASC,GAA6B;AACzE,QAAM,EAAE,KAAAC,GAAK,KAAAC,GAAK,MAAAC,IAAO,IAAO,OAAAC,MAAUJ,GAEpCK,IAA2B;AAAA,IAC/B,IAAIC,GAAQC,GAAMC,GAAU;AAC1B,UAAIJ,KAAS,CAACA,EAAM,SAASG,CAAe;AAC1C,eAAO,QAAQ,IAAID,GAAQC,GAAMC,CAAQ;AAG3C,UAAIC,IAAQ,QAAQ,IAAIH,GAAQC,GAAMC,CAAQ;AAO9C,aALIN,MAEFO,IAAQP,EAAIK,GAAME,GAAOH,CAAM,IAG7BH,KAAQO,EAASD,CAAK,IACjBX,EAAMW,GAAqBT,CAAO,IAGpCS;AAAA,IACT;AAAA,IACA,IAAIH,GAAQC,GAAMI,GAAKH,GAAU;AAC/B,UAAIJ,KAAS,CAACA,EAAM,SAASG,CAAe;AAC1C,eAAO,QAAQ,IAAID,GAAQC,GAAMI,GAAKH,CAAQ;AAGhD,YAAMI,IAAON,EAAOC,CAAe,GAC7BE,IAAQR,IAAMA,EAAIM,GAAMI,GAAKC,GAAMN,CAAM,IAAIK;AAEnD,aAAIR,KAAQO,EAASD,CAAK,IACjB,QAAQ,IAAIH,GAAQC,GAAMT,EAAMW,GAAqBT,CAAO,GAAGQ,CAAQ,IAGzE,QAAQ,IAAIF,GAAQC,GAAME,GAAOD,CAAQ;AAAA,IAClD;AAAA,EAAA;AAGF,SAAO,IAAI,MAAMT,GAAMM,CAAO;AAChC;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../typed/isArray.cjs"),s=require("../typed/isEmpty.cjs"),d=require("../typed/isNil.cjs"),f=require("../typed/isObject.cjs"),u=require("../typed/isString.cjs");function e(r){if(!d.isNil(r)){if(u.isString(r)){const i=r.trim();return i===""?void 0:i}if(c.isArray(r)){const i=r.map(t=>e(t)).filter(t=>!s.isEmpty(t));return i.length===0?void 0:i}if(f.isObject(r)){const i={};for(const[t,o]of Object.entries(r)){const n=e(o);s.isEmpty(n)||(i[t]=n)}return Object.keys(i).length===0?void 0:i}return r}}exports.prune=e;
|
|
2
|
+
//# sourceMappingURL=prune.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.cjs","sources":["../../src/function/prune.ts"],"sourcesContent":["import { isArray } from '../typed/isArray';\nimport { isEmpty } from '../typed/isEmpty';\nimport { isNil } from '../typed/isNil';\nimport { isObject } from '../typed/isObject';\nimport { isString } from '../typed/isString';\n\n/**\n * Removes all nullable and empty values from strings, arrays, or objects.\n *\n * - For strings: Removes leading/trailing whitespace and returns undefined if empty\n * - For arrays: Recursively removes null, undefined, empty strings, and empty objects/arrays\n * - For objects: Recursively removes properties with null, undefined, empty strings, and empty objects/arrays\n *\n * @example\n * ```ts\n * prune(' hello '); // 'hello'\n * prune(' '); // undefined\n * prune([1, null, '', 2, undefined, 3]); // [1, 2, 3]\n * prune({ a: 1, b: null, c: '', d: 2 }); // { a: 1, d: 2 }\n * prune({ a: { b: null, c: '' }, d: 1 }); // { d: 1 }\n * ```\n *\n * @param value - The value to prune (can be string, array, object, or any other type)\n * @returns The pruned value, or undefined if the result would be empty\n */\nexport function prune<T>(value: T): T | undefined {\n // Handle null/undefined\n if (isNil(value)) {\n return undefined;\n }\n\n // Handle strings\n if (isString(value)) {\n const trimmed = value.trim();\n return (trimmed === '' ? undefined : trimmed) as T | undefined;\n }\n\n // Handle arrays\n if (isArray(value)) {\n const cleaned = value.map((item) => prune(item)).filter((item) => !isEmpty(item));\n\n return (cleaned.length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n // Handle objects\n if (isObject(value)) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(value)) {\n const cleanedValue = prune(val);\n\n // Skip nil, empty strings, and empty arrays/objects\n if (!isEmpty(cleanedValue)) {\n cleaned[key] = cleanedValue;\n }\n }\n\n return (Object.keys(cleaned).length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n // For other types (numbers, booleans, etc.), return as-is\n return value;\n}\n"],"names":["prune","value","isNil","isString","trimmed","isArray","cleaned","item","isEmpty","isObject","key","val","cleanedValue"],"mappings":"gQAyBO,SAASA,EAASC,EAAyB,CAEhD,GAAIC,CAAAA,EAAAA,MAAMD,CAAK,EAKf,IAAIE,EAAAA,SAASF,CAAK,EAAG,CACnB,MAAMG,EAAUH,EAAM,KAAA,EACtB,OAAQG,IAAY,GAAK,OAAYA,CACvC,CAGA,GAAIC,EAAAA,QAAQJ,CAAK,EAAG,CAClB,MAAMK,EAAUL,EAAM,IAAKM,GAASP,EAAMO,CAAI,CAAC,EAAE,OAAQA,GAAS,CAACC,EAAAA,QAAQD,CAAI,CAAC,EAEhF,OAAQD,EAAQ,SAAW,EAAI,OAAYA,CAC7C,CAGA,GAAIG,EAAAA,SAASR,CAAK,EAAG,CACnB,MAAMK,EAAmC,CAAA,EAEzC,SAAW,CAACI,EAAKC,CAAG,IAAK,OAAO,QAAQV,CAAK,EAAG,CAC9C,MAAMW,EAAeZ,EAAMW,CAAG,EAGzBH,EAAAA,QAAQI,CAAY,IACvBN,EAAQI,CAAG,EAAIE,EAEnB,CAEA,OAAQ,OAAO,KAAKN,CAAO,EAAE,SAAW,EAAI,OAAYA,CAC1D,CAGA,OAAOL,EACT"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isArray as f } from "../typed/isArray.js";
|
|
2
|
+
import { isEmpty as n } from "../typed/isEmpty.js";
|
|
3
|
+
import { isNil as c } from "../typed/isNil.js";
|
|
4
|
+
import { isObject as s } from "../typed/isObject.js";
|
|
5
|
+
import { isString as p } from "../typed/isString.js";
|
|
6
|
+
function e(t) {
|
|
7
|
+
if (!c(t)) {
|
|
8
|
+
if (p(t)) {
|
|
9
|
+
const r = t.trim();
|
|
10
|
+
return r === "" ? void 0 : r;
|
|
11
|
+
}
|
|
12
|
+
if (f(t)) {
|
|
13
|
+
const r = t.map((i) => e(i)).filter((i) => !n(i));
|
|
14
|
+
return r.length === 0 ? void 0 : r;
|
|
15
|
+
}
|
|
16
|
+
if (s(t)) {
|
|
17
|
+
const r = {};
|
|
18
|
+
for (const [i, m] of Object.entries(t)) {
|
|
19
|
+
const o = e(m);
|
|
20
|
+
n(o) || (r[i] = o);
|
|
21
|
+
}
|
|
22
|
+
return Object.keys(r).length === 0 ? void 0 : r;
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
e as prune
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.js","sources":["../../src/function/prune.ts"],"sourcesContent":["import { isArray } from '../typed/isArray';\nimport { isEmpty } from '../typed/isEmpty';\nimport { isNil } from '../typed/isNil';\nimport { isObject } from '../typed/isObject';\nimport { isString } from '../typed/isString';\n\n/**\n * Removes all nullable and empty values from strings, arrays, or objects.\n *\n * - For strings: Removes leading/trailing whitespace and returns undefined if empty\n * - For arrays: Recursively removes null, undefined, empty strings, and empty objects/arrays\n * - For objects: Recursively removes properties with null, undefined, empty strings, and empty objects/arrays\n *\n * @example\n * ```ts\n * prune(' hello '); // 'hello'\n * prune(' '); // undefined\n * prune([1, null, '', 2, undefined, 3]); // [1, 2, 3]\n * prune({ a: 1, b: null, c: '', d: 2 }); // { a: 1, d: 2 }\n * prune({ a: { b: null, c: '' }, d: 1 }); // { d: 1 }\n * ```\n *\n * @param value - The value to prune (can be string, array, object, or any other type)\n * @returns The pruned value, or undefined if the result would be empty\n */\nexport function prune<T>(value: T): T | undefined {\n // Handle null/undefined\n if (isNil(value)) {\n return undefined;\n }\n\n // Handle strings\n if (isString(value)) {\n const trimmed = value.trim();\n return (trimmed === '' ? undefined : trimmed) as T | undefined;\n }\n\n // Handle arrays\n if (isArray(value)) {\n const cleaned = value.map((item) => prune(item)).filter((item) => !isEmpty(item));\n\n return (cleaned.length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n // Handle objects\n if (isObject(value)) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(value)) {\n const cleanedValue = prune(val);\n\n // Skip nil, empty strings, and empty arrays/objects\n if (!isEmpty(cleanedValue)) {\n cleaned[key] = cleanedValue;\n }\n }\n\n return (Object.keys(cleaned).length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n // For other types (numbers, booleans, etc.), return as-is\n return value;\n}\n"],"names":["prune","value","isNil","isString","trimmed","isArray","cleaned","item","isEmpty","isObject","key","val","cleanedValue"],"mappings":";;;;;AAyBO,SAASA,EAASC,GAAyB;AAEhD,MAAI,CAAAC,EAAMD,CAAK,GAKf;AAAA,QAAIE,EAASF,CAAK,GAAG;AACnB,YAAMG,IAAUH,EAAM,KAAA;AACtB,aAAQG,MAAY,KAAK,SAAYA;AAAA,IACvC;AAGA,QAAIC,EAAQJ,CAAK,GAAG;AAClB,YAAMK,IAAUL,EAAM,IAAI,CAACM,MAASP,EAAMO,CAAI,CAAC,EAAE,OAAO,CAACA,MAAS,CAACC,EAAQD,CAAI,CAAC;AAEhF,aAAQD,EAAQ,WAAW,IAAI,SAAYA;AAAA,IAC7C;AAGA,QAAIG,EAASR,CAAK,GAAG;AACnB,YAAMK,IAAmC,CAAA;AAEzC,iBAAW,CAACI,GAAKC,CAAG,KAAK,OAAO,QAAQV,CAAK,GAAG;AAC9C,cAAMW,IAAeZ,EAAMW,CAAG;AAG9B,QAAKH,EAAQI,CAAY,MACvBN,EAAQI,CAAG,IAAIE;AAAA,MAEnB;AAEA,aAAQ,OAAO,KAAKN,CAAO,EAAE,WAAW,IAAI,SAAYA;AAAA,IAC1D;AAGA,WAAOL;AAAA;AACT;"}
|
package/dist/function/retry.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../logit/dist/logit.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../logit/dist/logit.cjs"),u=require("./sleep.cjs");async function c(i,{times:e=3,delay:y=250,backoff:o=1,signal:l}={}){let t=y;for(let r=1;r<=e;r++){if(l?.aborted)throw a.Logit.warn(`retry() -> Aborted after ${r-1} attempts`),new Error("Retry aborted");try{return await i()}catch(n){if(r===e)throw n;a.Logit.warn(`retry() -> ${n}, attempt ${r}/${e}, retrying in ${t}ms`),t>0&&await u.sleep(t),t=typeof o=="function"?o(r,t):t*o}}throw new Error("Retry failed unexpectedly")}exports.retry=c;
|
|
2
2
|
//# sourceMappingURL=retry.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.cjs","sources":["../../src/function/retry.ts"],"sourcesContent":["import { Logit } from '@vielzeug/logit';\nimport { sleep } from './sleep';\n\n/**\n * Retries an asynchronous function a specified number of times with delay and optional exponential backoff.\n *\n * @example\n * ```ts\n * retry(() => fetchData(), { times: 3, delay: 1000, backoff: 2, signal: abortSignal })\n * .then(result => console.log(result))\n * .catch(error => console.error(error));\n * ```\n *\n * @param fn - The asynchronous function to retry.\n * @param options - (optional) Options for retrying the function.\n * @param [options.times=3] - The number of retry attempts.\n * @param [options.delay=250] - The delay in milliseconds between retries.\n * @param [options.backoff=1] - Exponential backoff factor (default: 1 → no backoff).\n * @param [options.signal] - `AbortSignal` to allow canceling retries.\n *\n * @returns The result of the asynchronous function.\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n {\n times = 3,\n delay = 250,\n backoff = 1,\n signal,\n }: {\n times?: number;\n delay?: number;\n backoff?: number;\n signal?: AbortSignal;\n } = {},\n): Promise<T> {\n let currentDelay = delay;\n\n for (let attempt = 1; attempt <= times; attempt++) {\n if (signal?.aborted) {\n Logit.warn(`retry() -> Aborted after ${attempt - 1} attempts`);\n throw new Error('Retry aborted');\n }\n\n try {\n return await fn();\n } catch (err) {\n if (attempt === times) throw err;\n\n Logit.warn(`retry() -> ${err}, attempt ${attempt}/${times}, retrying in ${currentDelay}ms`);\n if (currentDelay > 0) await sleep(currentDelay);\n currentDelay
|
|
1
|
+
{"version":3,"file":"retry.cjs","sources":["../../src/function/retry.ts"],"sourcesContent":["import { Logit } from '@vielzeug/logit';\nimport { sleep } from './sleep';\n\n/**\n * Retries an asynchronous function a specified number of times with delay and optional exponential backoff.\n *\n * @example\n * ```ts\n * retry(() => fetchData(), { times: 3, delay: 1000, backoff: 2, signal: abortSignal })\n * .then(result => console.log(result))\n * .catch(error => console.error(error));\n * ```\n *\n * @param fn - The asynchronous function to retry.\n * @param options - (optional) Options for retrying the function.\n * @param [options.times=3] - The number of retry attempts.\n * @param [options.delay=250] - The delay in milliseconds between retries.\n * @param [options.backoff=1] - Exponential backoff factor (default: 1 → no backoff).\n * @param [options.signal] - `AbortSignal` to allow canceling retries.\n *\n * @returns The result of the asynchronous function.\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n {\n times = 3,\n delay = 250,\n backoff = 1,\n signal,\n }: {\n times?: number;\n delay?: number;\n backoff?: number | ((attempt: number, delay: number) => number);\n signal?: AbortSignal;\n } = {},\n): Promise<T> {\n let currentDelay = delay;\n\n for (let attempt = 1; attempt <= times; attempt++) {\n if (signal?.aborted) {\n Logit.warn(`retry() -> Aborted after ${attempt - 1} attempts`);\n throw new Error('Retry aborted');\n }\n\n try {\n return await fn();\n } catch (err) {\n if (attempt === times) throw err;\n\n Logit.warn(`retry() -> ${err}, attempt ${attempt}/${times}, retrying in ${currentDelay}ms`);\n if (currentDelay > 0) await sleep(currentDelay);\n\n currentDelay = typeof backoff === 'function' ? backoff(attempt, currentDelay) : currentDelay * backoff;\n }\n }\n\n throw new Error('Retry failed unexpectedly');\n}\n"],"names":["retry","fn","times","delay","backoff","signal","currentDelay","attempt","Logit","err","sleep"],"mappings":"oJAsBA,eAAsBA,EACpBC,EACA,CACE,MAAAC,EAAQ,EACR,MAAAC,EAAQ,IACR,QAAAC,EAAU,EACV,OAAAC,CACF,EAKI,GACQ,CACZ,IAAIC,EAAeH,EAEnB,QAASI,EAAU,EAAGA,GAAWL,EAAOK,IAAW,CACjD,GAAIF,GAAQ,QACVG,MAAAA,EAAAA,MAAM,KAAK,4BAA4BD,EAAU,CAAC,WAAW,EACvD,IAAI,MAAM,eAAe,EAGjC,GAAI,CACF,OAAO,MAAMN,EAAA,CACf,OAASQ,EAAK,CACZ,GAAIF,IAAYL,EAAO,MAAMO,EAE7BD,EAAAA,MAAM,KAAK,cAAcC,CAAG,aAAaF,CAAO,IAAIL,CAAK,iBAAiBI,CAAY,IAAI,EACtFA,EAAe,GAAG,MAAMI,EAAAA,MAAMJ,CAAY,EAE9CA,EAAe,OAAOF,GAAY,WAAaA,EAAQG,EAASD,CAAY,EAAIA,EAAeF,CACjG,CACF,CAEA,MAAM,IAAI,MAAM,2BAA2B,CAC7C"}
|
package/dist/function/retry.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Logit as
|
|
1
|
+
import { Logit as n } from "../logit/dist/logit.js";
|
|
2
2
|
import { sleep as w } from "./sleep.js";
|
|
3
|
-
async function
|
|
3
|
+
async function m(y, {
|
|
4
4
|
times: e = 3,
|
|
5
|
-
delay:
|
|
6
|
-
backoff:
|
|
7
|
-
signal:
|
|
5
|
+
delay: i = 250,
|
|
6
|
+
backoff: o = 1,
|
|
7
|
+
signal: p
|
|
8
8
|
} = {}) {
|
|
9
|
-
let
|
|
10
|
-
for (let
|
|
11
|
-
if (
|
|
12
|
-
throw
|
|
9
|
+
let r = i;
|
|
10
|
+
for (let t = 1; t <= e; t++) {
|
|
11
|
+
if (p?.aborted)
|
|
12
|
+
throw n.warn(`retry() -> Aborted after ${t - 1} attempts`), new Error("Retry aborted");
|
|
13
13
|
try {
|
|
14
|
-
return await
|
|
14
|
+
return await y();
|
|
15
15
|
} catch (a) {
|
|
16
|
-
if (
|
|
17
|
-
|
|
16
|
+
if (t === e) throw a;
|
|
17
|
+
n.warn(`retry() -> ${a}, attempt ${t}/${e}, retrying in ${r}ms`), r > 0 && await w(r), r = typeof o == "function" ? o(t, r) : r * o;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
throw new Error("Retry failed unexpectedly");
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
m as retry
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=retry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sources":["../../src/function/retry.ts"],"sourcesContent":["import { Logit } from '@vielzeug/logit';\nimport { sleep } from './sleep';\n\n/**\n * Retries an asynchronous function a specified number of times with delay and optional exponential backoff.\n *\n * @example\n * ```ts\n * retry(() => fetchData(), { times: 3, delay: 1000, backoff: 2, signal: abortSignal })\n * .then(result => console.log(result))\n * .catch(error => console.error(error));\n * ```\n *\n * @param fn - The asynchronous function to retry.\n * @param options - (optional) Options for retrying the function.\n * @param [options.times=3] - The number of retry attempts.\n * @param [options.delay=250] - The delay in milliseconds between retries.\n * @param [options.backoff=1] - Exponential backoff factor (default: 1 → no backoff).\n * @param [options.signal] - `AbortSignal` to allow canceling retries.\n *\n * @returns The result of the asynchronous function.\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n {\n times = 3,\n delay = 250,\n backoff = 1,\n signal,\n }: {\n times?: number;\n delay?: number;\n backoff?: number;\n signal?: AbortSignal;\n } = {},\n): Promise<T> {\n let currentDelay = delay;\n\n for (let attempt = 1; attempt <= times; attempt++) {\n if (signal?.aborted) {\n Logit.warn(`retry() -> Aborted after ${attempt - 1} attempts`);\n throw new Error('Retry aborted');\n }\n\n try {\n return await fn();\n } catch (err) {\n if (attempt === times) throw err;\n\n Logit.warn(`retry() -> ${err}, attempt ${attempt}/${times}, retrying in ${currentDelay}ms`);\n if (currentDelay > 0) await sleep(currentDelay);\n currentDelay
|
|
1
|
+
{"version":3,"file":"retry.js","sources":["../../src/function/retry.ts"],"sourcesContent":["import { Logit } from '@vielzeug/logit';\nimport { sleep } from './sleep';\n\n/**\n * Retries an asynchronous function a specified number of times with delay and optional exponential backoff.\n *\n * @example\n * ```ts\n * retry(() => fetchData(), { times: 3, delay: 1000, backoff: 2, signal: abortSignal })\n * .then(result => console.log(result))\n * .catch(error => console.error(error));\n * ```\n *\n * @param fn - The asynchronous function to retry.\n * @param options - (optional) Options for retrying the function.\n * @param [options.times=3] - The number of retry attempts.\n * @param [options.delay=250] - The delay in milliseconds between retries.\n * @param [options.backoff=1] - Exponential backoff factor (default: 1 → no backoff).\n * @param [options.signal] - `AbortSignal` to allow canceling retries.\n *\n * @returns The result of the asynchronous function.\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n {\n times = 3,\n delay = 250,\n backoff = 1,\n signal,\n }: {\n times?: number;\n delay?: number;\n backoff?: number | ((attempt: number, delay: number) => number);\n signal?: AbortSignal;\n } = {},\n): Promise<T> {\n let currentDelay = delay;\n\n for (let attempt = 1; attempt <= times; attempt++) {\n if (signal?.aborted) {\n Logit.warn(`retry() -> Aborted after ${attempt - 1} attempts`);\n throw new Error('Retry aborted');\n }\n\n try {\n return await fn();\n } catch (err) {\n if (attempt === times) throw err;\n\n Logit.warn(`retry() -> ${err}, attempt ${attempt}/${times}, retrying in ${currentDelay}ms`);\n if (currentDelay > 0) await sleep(currentDelay);\n\n currentDelay = typeof backoff === 'function' ? backoff(attempt, currentDelay) : currentDelay * backoff;\n }\n }\n\n throw new Error('Retry failed unexpectedly');\n}\n"],"names":["retry","fn","times","delay","backoff","signal","currentDelay","attempt","Logit","err","sleep"],"mappings":";;AAsBA,eAAsBA,EACpBC,GACA;AAAA,EACE,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,QAAAC;AACF,IAKI,IACQ;AACZ,MAAIC,IAAeH;AAEnB,WAASI,IAAU,GAAGA,KAAWL,GAAOK,KAAW;AACjD,QAAIF,GAAQ;AACVG,YAAAA,EAAM,KAAK,4BAA4BD,IAAU,CAAC,WAAW,GACvD,IAAI,MAAM,eAAe;AAGjC,QAAI;AACF,aAAO,MAAMN,EAAA;AAAA,IACf,SAASQ,GAAK;AACZ,UAAIF,MAAYL,EAAO,OAAMO;AAE7BD,MAAAA,EAAM,KAAK,cAAcC,CAAG,aAAaF,CAAO,IAAIL,CAAK,iBAAiBI,CAAY,IAAI,GACtFA,IAAe,KAAG,MAAMI,EAAMJ,CAAY,GAE9CA,IAAe,OAAOF,KAAY,aAAaA,EAAQG,GAASD,CAAY,IAAIA,IAAeF;AAAA,IACjG;AAAA,EACF;AAEA,QAAM,IAAI,MAAM,2BAA2B;AAC7C;"}
|
package/dist/function/sleep.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./assert.cjs");async function s(e){return n.assert(typeof e=="number"&&e>=0&&Number.isFinite(e),"Timeout must be a non-negative finite number",{args:{timeout:e},type:TypeError}),new Promise(r=>setTimeout(r,e))}exports.sleep=s;
|
|
2
2
|
//# sourceMappingURL=sleep.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.cjs","sources":["../../src/function/sleep.ts"],"sourcesContent":["/**\n * Creates a Promise that resolves after a specified amount of time.\n *\n * @example\n * ```ts\n * sleep(1000).then(() => console.log('Hello, world!')); // logs 'Hello, world!' after 1 second\n * ```\n *\n * @param timeout - The number of milliseconds to wait before resolving the Promise.\n *\n * @returns A Promise that resolves after the specified time.\n */\nexport async function sleep(timeout: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, timeout));\n}\n"],"names":["sleep","timeout","resolve"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sleep.cjs","sources":["../../src/function/sleep.ts"],"sourcesContent":["import { assert } from './assert';\n\n/**\n * Creates a Promise that resolves after a specified amount of time.\n *\n * @example\n * ```ts\n * sleep(1000).then(() => console.log('Hello, world!')); // logs 'Hello, world!' after 1 second\n * ```\n *\n * @param timeout - The number of milliseconds to wait before resolving the Promise.\n *\n * @returns A Promise that resolves after the specified time.\n *\n * @throws {TypeError} If timeout is not a non-negative number.\n */\nexport async function sleep(timeout: number): Promise<void> {\n assert(\n typeof timeout === 'number' && timeout >= 0 && Number.isFinite(timeout),\n 'Timeout must be a non-negative finite number',\n { args: { timeout }, type: TypeError },\n );\n return new Promise((resolve) => setTimeout(resolve, timeout));\n}\n"],"names":["sleep","timeout","assert","resolve"],"mappings":"gHAgBA,eAAsBA,EAAMC,EAAgC,CAC1DC,OAAAA,EAAAA,OACE,OAAOD,GAAY,UAAYA,GAAW,GAAK,OAAO,SAASA,CAAO,EACtE,+CACA,CAAE,KAAM,CAAE,QAAAA,CAAA,EAAW,KAAM,SAAA,CAAU,EAEhC,IAAI,QAASE,GAAY,WAAWA,EAASF,CAAO,CAAC,CAC9D"}
|
package/dist/function/sleep.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { assert as n } from "./assert.js";
|
|
2
|
+
async function i(e) {
|
|
3
|
+
return n(
|
|
4
|
+
typeof e == "number" && e >= 0 && Number.isFinite(e),
|
|
5
|
+
"Timeout must be a non-negative finite number",
|
|
6
|
+
{ args: { timeout: e }, type: TypeError }
|
|
7
|
+
), new Promise((r) => setTimeout(r, e));
|
|
3
8
|
}
|
|
4
9
|
export {
|
|
5
|
-
|
|
10
|
+
i as sleep
|
|
6
11
|
};
|
|
7
12
|
//# sourceMappingURL=sleep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.js","sources":["../../src/function/sleep.ts"],"sourcesContent":["/**\n * Creates a Promise that resolves after a specified amount of time.\n *\n * @example\n * ```ts\n * sleep(1000).then(() => console.log('Hello, world!')); // logs 'Hello, world!' after 1 second\n * ```\n *\n * @param timeout - The number of milliseconds to wait before resolving the Promise.\n *\n * @returns A Promise that resolves after the specified time.\n */\nexport async function sleep(timeout: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, timeout));\n}\n"],"names":["sleep","timeout","resolve"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sleep.js","sources":["../../src/function/sleep.ts"],"sourcesContent":["import { assert } from './assert';\n\n/**\n * Creates a Promise that resolves after a specified amount of time.\n *\n * @example\n * ```ts\n * sleep(1000).then(() => console.log('Hello, world!')); // logs 'Hello, world!' after 1 second\n * ```\n *\n * @param timeout - The number of milliseconds to wait before resolving the Promise.\n *\n * @returns A Promise that resolves after the specified time.\n *\n * @throws {TypeError} If timeout is not a non-negative number.\n */\nexport async function sleep(timeout: number): Promise<void> {\n assert(\n typeof timeout === 'number' && timeout >= 0 && Number.isFinite(timeout),\n 'Timeout must be a non-negative finite number',\n { args: { timeout }, type: TypeError },\n );\n return new Promise((resolve) => setTimeout(resolve, timeout));\n}\n"],"names":["sleep","timeout","assert","resolve"],"mappings":";AAgBA,eAAsBA,EAAMC,GAAgC;AAC1D,SAAAC;AAAA,IACE,OAAOD,KAAY,YAAYA,KAAW,KAAK,OAAO,SAASA,CAAO;AAAA,IACtE;AAAA,IACA,EAAE,MAAM,EAAE,SAAAA,EAAA,GAAW,MAAM,UAAA;AAAA,EAAU,GAEhC,IAAI,QAAQ,CAACE,MAAY,WAAWA,GAASF,CAAO,CAAC;AAC9D;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./assert.cjs");function b(u,o=700,f={leading:!0,trailing:!0}){p.assert(typeof u=="function","First argument must be a function",{args:{fn:u},type:TypeError}),p.assert(typeof o=="number"&&o>=0,"Delay must be a non-negative number",{args:{delay:o},type:TypeError});const T=f.leading??!0,y=f.trailing??!1;let n,i=0,e,s,m;const c=()=>{n!==void 0&&(clearTimeout(n),n=void 0)},g=t=>{if(i=t,c(),!e)return;const r=e,l=s;return e=void 0,s=void 0,m=u.apply(l,r),m},d=t=>o-(t-i),v=()=>{const t=Date.now();e&&d(t)<=0?g(t):e?n=setTimeout(v,d(t)):c()},a=function(...t){const r=Date.now();i===0&&!T&&(i=r),e=t,s=this;const l=d(r);l<=0?g(r):y&&!n&&(n=setTimeout(v,l))};return a.cancel=()=>{c(),e=void 0,s=void 0,i=0},a.flush=()=>{if(!e)return;const t=Date.now();return g(t)},a.pending=()=>e!==void 0||n!==void 0,a}exports.throttle=b;
|
|
2
2
|
//# sourceMappingURL=throttle.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.cjs","sources":["../../src/function/throttle.ts"],"sourcesContent":["import type { Fn } from '../types';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"throttle.cjs","sources":["../../src/function/throttle.ts"],"sourcesContent":["import type { Fn } from '../types';\nimport { assert } from './assert';\n\nexport type ThrottleOptions = {\n leading?: boolean; // invoke at the start of the window\n trailing?: boolean; // invoke at the end with the last args\n};\n\nexport type Throttled<T extends Fn> = ((this: ThisParameterType<T>, ...args: Parameters<T>) => void) & {\n cancel(): void;\n flush(): ReturnType<T> | undefined;\n pending(): boolean; // whether there's a pending call that flush() would execute\n};\n\n/**\n * Throttles a function. By default, leading and trailing are both true (lodash-like behavior).\n * The function is invoked at the leading edge and trailing edge of the throttle period.\n *\n * Example:\n * const fn = () => ...\n * const t = throttle(fn, 700);\n * const leadingOnly = throttle(fn, 700, { trailing: false });\n */\nexport function throttle<T extends Fn>(\n fn: T,\n delay = 700,\n options: ThrottleOptions = { leading: true, trailing: true },\n): Throttled<T> {\n assert(typeof fn === 'function', 'First argument must be a function', {\n args: { fn },\n type: TypeError,\n });\n assert(typeof delay === 'number' && delay >= 0, 'Delay must be a non-negative number', {\n args: { delay },\n type: TypeError,\n });\n\n const leading = options.leading ?? true;\n const trailing = options.trailing ?? false;\n\n let timer: ReturnType<typeof setTimeout> | undefined;\n let lastInvokeTime = 0;\n let lastArgs: Parameters<T> | undefined;\n let lastThis: ThisParameterType<T> | undefined;\n let lastResult: ReturnType<T> | undefined;\n\n const clearTimer = () => {\n if (timer !== undefined) {\n clearTimeout(timer);\n timer = undefined;\n }\n };\n\n const invoke = (now: number) => {\n lastInvokeTime = now;\n clearTimer();\n if (!lastArgs) return undefined;\n const args = lastArgs;\n const ctx = lastThis as ThisParameterType<T>;\n lastArgs = undefined;\n lastThis = undefined;\n // biome-ignore lint/suspicious/noExplicitAny: -\n lastResult = fn.apply(ctx as any, args);\n return lastResult;\n };\n\n const remaining = (now: number) => delay - (now - lastInvokeTime);\n\n const timerExpired = () => {\n const now = Date.now();\n if (lastArgs && remaining(now) <= 0) {\n // trailing edge invoke\n invoke(now);\n } else if (lastArgs) {\n // reschedule until a window elapses\n timer = setTimeout(timerExpired, remaining(now));\n } else {\n clearTimer();\n }\n };\n\n const throttled = function (this: ThisParameterType<T>, ...args: Parameters<T>) {\n const now = Date.now();\n if (lastInvokeTime === 0 && !leading) {\n // If leading is false, start the window now but don't invoke immediately\n lastInvokeTime = now;\n }\n\n lastArgs = args;\n lastThis = this;\n\n const rem = remaining(now);\n\n if (rem <= 0) {\n // Window elapsed: invoke now\n invoke(now);\n } else if (trailing && !timer) {\n // Schedule trailing call if not already scheduled\n timer = setTimeout(timerExpired, rem);\n }\n } as Throttled<T>;\n\n throttled.cancel = () => {\n clearTimer();\n lastArgs = undefined;\n lastThis = undefined;\n lastInvokeTime = 0;\n };\n\n throttled.flush = () => {\n if (!lastArgs) return undefined;\n const now = Date.now();\n return invoke(now) as ReturnType<T> | undefined;\n };\n\n // Pending if a trailing call is scheduled OR there are queued args.\n throttled.pending = () => lastArgs !== undefined || timer !== undefined;\n\n return throttled;\n}\n"],"names":["throttle","fn","delay","options","assert","leading","trailing","timer","lastInvokeTime","lastArgs","lastThis","lastResult","clearTimer","invoke","now","args","ctx","remaining","timerExpired","throttled","rem"],"mappings":"gHAuBO,SAASA,EACdC,EACAC,EAAQ,IACRC,EAA2B,CAAE,QAAS,GAAM,SAAU,IACxC,CACdC,EAAAA,OAAO,OAAOH,GAAO,WAAY,oCAAqC,CACpE,KAAM,CAAE,GAAAA,CAAA,EACR,KAAM,SAAA,CACP,EACDG,EAAAA,OAAO,OAAOF,GAAU,UAAYA,GAAS,EAAG,sCAAuC,CACrF,KAAM,CAAE,MAAAA,CAAA,EACR,KAAM,SAAA,CACP,EAED,MAAMG,EAAUF,EAAQ,SAAW,GAC7BG,EAAWH,EAAQ,UAAY,GAErC,IAAII,EACAC,EAAiB,EACjBC,EACAC,EACAC,EAEJ,MAAMC,EAAa,IAAM,CACnBL,IAAU,SACZ,aAAaA,CAAK,EAClBA,EAAQ,OAEZ,EAEMM,EAAUC,GAAgB,CAG9B,GAFAN,EAAiBM,EACjBF,EAAA,EACI,CAACH,EAAU,OACf,MAAMM,EAAON,EACPO,EAAMN,EACZ,OAAAD,EAAW,OACXC,EAAW,OAEXC,EAAaV,EAAG,MAAMe,EAAYD,CAAI,EAC/BJ,CACT,EAEMM,EAAaH,GAAgBZ,GAASY,EAAMN,GAE5CU,EAAe,IAAM,CACzB,MAAMJ,EAAM,KAAK,IAAA,EACbL,GAAYQ,EAAUH,CAAG,GAAK,EAEhCD,EAAOC,CAAG,EACDL,EAETF,EAAQ,WAAWW,EAAcD,EAAUH,CAAG,CAAC,EAE/CF,EAAA,CAEJ,EAEMO,EAAY,YAAyCJ,EAAqB,CAC9E,MAAMD,EAAM,KAAK,IAAA,EACbN,IAAmB,GAAK,CAACH,IAE3BG,EAAiBM,GAGnBL,EAAWM,EACXL,EAAW,KAEX,MAAMU,EAAMH,EAAUH,CAAG,EAErBM,GAAO,EAETP,EAAOC,CAAG,EACDR,GAAY,CAACC,IAEtBA,EAAQ,WAAWW,EAAcE,CAAG,EAExC,EAEA,OAAAD,EAAU,OAAS,IAAM,CACvBP,EAAA,EACAH,EAAW,OACXC,EAAW,OACXF,EAAiB,CACnB,EAEAW,EAAU,MAAQ,IAAM,CACtB,GAAI,CAACV,EAAU,OACf,MAAMK,EAAM,KAAK,IAAA,EACjB,OAAOD,EAAOC,CAAG,CACnB,EAGAK,EAAU,QAAU,IAAMV,IAAa,QAAaF,IAAU,OAEvDY,CACT"}
|
|
@@ -1,11 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { assert as p } from "./assert.js";
|
|
2
|
+
function y(c, r = 700, g = { leading: !0, trailing: !0 }) {
|
|
3
|
+
p(typeof c == "function", "First argument must be a function", {
|
|
4
|
+
args: { fn: c },
|
|
5
|
+
type: TypeError
|
|
6
|
+
}), p(typeof r == "number" && r >= 0, "Delay must be a non-negative number", {
|
|
7
|
+
args: { delay: r },
|
|
8
|
+
type: TypeError
|
|
9
|
+
});
|
|
10
|
+
const T = g.leading ?? !0, w = g.trailing ?? !1;
|
|
11
|
+
let n, i = 0, e, s, d;
|
|
12
|
+
const u = () => {
|
|
13
|
+
n !== void 0 && (clearTimeout(n), n = void 0);
|
|
14
|
+
}, m = (t) => {
|
|
15
|
+
if (i = t, u(), !e) return;
|
|
16
|
+
const o = e, l = s;
|
|
17
|
+
return e = void 0, s = void 0, d = c.apply(l, o), d;
|
|
18
|
+
}, f = (t) => r - (t - i), v = () => {
|
|
19
|
+
const t = Date.now();
|
|
20
|
+
e && f(t) <= 0 ? m(t) : e ? n = setTimeout(v, f(t)) : u();
|
|
21
|
+
}, a = function(...t) {
|
|
22
|
+
const o = Date.now();
|
|
23
|
+
i === 0 && !T && (i = o), e = t, s = this;
|
|
24
|
+
const l = f(o);
|
|
25
|
+
l <= 0 ? m(o) : w && !n && (n = setTimeout(v, l));
|
|
6
26
|
};
|
|
27
|
+
return a.cancel = () => {
|
|
28
|
+
u(), e = void 0, s = void 0, i = 0;
|
|
29
|
+
}, a.flush = () => {
|
|
30
|
+
if (!e) return;
|
|
31
|
+
const t = Date.now();
|
|
32
|
+
return m(t);
|
|
33
|
+
}, a.pending = () => e !== void 0 || n !== void 0, a;
|
|
7
34
|
}
|
|
8
35
|
export {
|
|
9
|
-
|
|
36
|
+
y as throttle
|
|
10
37
|
};
|
|
11
38
|
//# sourceMappingURL=throttle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.js","sources":["../../src/function/throttle.ts"],"sourcesContent":["import type { Fn } from '../types';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"throttle.js","sources":["../../src/function/throttle.ts"],"sourcesContent":["import type { Fn } from '../types';\nimport { assert } from './assert';\n\nexport type ThrottleOptions = {\n leading?: boolean; // invoke at the start of the window\n trailing?: boolean; // invoke at the end with the last args\n};\n\nexport type Throttled<T extends Fn> = ((this: ThisParameterType<T>, ...args: Parameters<T>) => void) & {\n cancel(): void;\n flush(): ReturnType<T> | undefined;\n pending(): boolean; // whether there's a pending call that flush() would execute\n};\n\n/**\n * Throttles a function. By default, leading and trailing are both true (lodash-like behavior).\n * The function is invoked at the leading edge and trailing edge of the throttle period.\n *\n * Example:\n * const fn = () => ...\n * const t = throttle(fn, 700);\n * const leadingOnly = throttle(fn, 700, { trailing: false });\n */\nexport function throttle<T extends Fn>(\n fn: T,\n delay = 700,\n options: ThrottleOptions = { leading: true, trailing: true },\n): Throttled<T> {\n assert(typeof fn === 'function', 'First argument must be a function', {\n args: { fn },\n type: TypeError,\n });\n assert(typeof delay === 'number' && delay >= 0, 'Delay must be a non-negative number', {\n args: { delay },\n type: TypeError,\n });\n\n const leading = options.leading ?? true;\n const trailing = options.trailing ?? false;\n\n let timer: ReturnType<typeof setTimeout> | undefined;\n let lastInvokeTime = 0;\n let lastArgs: Parameters<T> | undefined;\n let lastThis: ThisParameterType<T> | undefined;\n let lastResult: ReturnType<T> | undefined;\n\n const clearTimer = () => {\n if (timer !== undefined) {\n clearTimeout(timer);\n timer = undefined;\n }\n };\n\n const invoke = (now: number) => {\n lastInvokeTime = now;\n clearTimer();\n if (!lastArgs) return undefined;\n const args = lastArgs;\n const ctx = lastThis as ThisParameterType<T>;\n lastArgs = undefined;\n lastThis = undefined;\n // biome-ignore lint/suspicious/noExplicitAny: -\n lastResult = fn.apply(ctx as any, args);\n return lastResult;\n };\n\n const remaining = (now: number) => delay - (now - lastInvokeTime);\n\n const timerExpired = () => {\n const now = Date.now();\n if (lastArgs && remaining(now) <= 0) {\n // trailing edge invoke\n invoke(now);\n } else if (lastArgs) {\n // reschedule until a window elapses\n timer = setTimeout(timerExpired, remaining(now));\n } else {\n clearTimer();\n }\n };\n\n const throttled = function (this: ThisParameterType<T>, ...args: Parameters<T>) {\n const now = Date.now();\n if (lastInvokeTime === 0 && !leading) {\n // If leading is false, start the window now but don't invoke immediately\n lastInvokeTime = now;\n }\n\n lastArgs = args;\n lastThis = this;\n\n const rem = remaining(now);\n\n if (rem <= 0) {\n // Window elapsed: invoke now\n invoke(now);\n } else if (trailing && !timer) {\n // Schedule trailing call if not already scheduled\n timer = setTimeout(timerExpired, rem);\n }\n } as Throttled<T>;\n\n throttled.cancel = () => {\n clearTimer();\n lastArgs = undefined;\n lastThis = undefined;\n lastInvokeTime = 0;\n };\n\n throttled.flush = () => {\n if (!lastArgs) return undefined;\n const now = Date.now();\n return invoke(now) as ReturnType<T> | undefined;\n };\n\n // Pending if a trailing call is scheduled OR there are queued args.\n throttled.pending = () => lastArgs !== undefined || timer !== undefined;\n\n return throttled;\n}\n"],"names":["throttle","fn","delay","options","assert","leading","trailing","timer","lastInvokeTime","lastArgs","lastThis","lastResult","clearTimer","invoke","now","args","ctx","remaining","timerExpired","throttled","rem"],"mappings":";AAuBO,SAASA,EACdC,GACAC,IAAQ,KACRC,IAA2B,EAAE,SAAS,IAAM,UAAU,MACxC;AACd,EAAAC,EAAO,OAAOH,KAAO,YAAY,qCAAqC;AAAA,IACpE,MAAM,EAAE,IAAAA,EAAA;AAAA,IACR,MAAM;AAAA,EAAA,CACP,GACDG,EAAO,OAAOF,KAAU,YAAYA,KAAS,GAAG,uCAAuC;AAAA,IACrF,MAAM,EAAE,OAAAA,EAAA;AAAA,IACR,MAAM;AAAA,EAAA,CACP;AAED,QAAMG,IAAUF,EAAQ,WAAW,IAC7BG,IAAWH,EAAQ,YAAY;AAErC,MAAII,GACAC,IAAiB,GACjBC,GACAC,GACAC;AAEJ,QAAMC,IAAa,MAAM;AACvB,IAAIL,MAAU,WACZ,aAAaA,CAAK,GAClBA,IAAQ;AAAA,EAEZ,GAEMM,IAAS,CAACC,MAAgB;AAG9B,QAFAN,IAAiBM,GACjBF,EAAA,GACI,CAACH,EAAU;AACf,UAAMM,IAAON,GACPO,IAAMN;AACZ,WAAAD,IAAW,QACXC,IAAW,QAEXC,IAAaV,EAAG,MAAMe,GAAYD,CAAI,GAC/BJ;AAAA,EACT,GAEMM,IAAY,CAACH,MAAgBZ,KAASY,IAAMN,IAE5CU,IAAe,MAAM;AACzB,UAAMJ,IAAM,KAAK,IAAA;AACjB,IAAIL,KAAYQ,EAAUH,CAAG,KAAK,IAEhCD,EAAOC,CAAG,IACDL,IAETF,IAAQ,WAAWW,GAAcD,EAAUH,CAAG,CAAC,IAE/CF,EAAA;AAAA,EAEJ,GAEMO,IAAY,YAAyCJ,GAAqB;AAC9E,UAAMD,IAAM,KAAK,IAAA;AACjB,IAAIN,MAAmB,KAAK,CAACH,MAE3BG,IAAiBM,IAGnBL,IAAWM,GACXL,IAAW;AAEX,UAAMU,IAAMH,EAAUH,CAAG;AAEzB,IAAIM,KAAO,IAETP,EAAOC,CAAG,IACDR,KAAY,CAACC,MAEtBA,IAAQ,WAAWW,GAAcE,CAAG;AAAA,EAExC;AAEA,SAAAD,EAAU,SAAS,MAAM;AACvB,IAAAP,EAAA,GACAH,IAAW,QACXC,IAAW,QACXF,IAAiB;AAAA,EACnB,GAEAW,EAAU,QAAQ,MAAM;AACtB,QAAI,CAACV,EAAU;AACf,UAAMK,IAAM,KAAK,IAAA;AACjB,WAAOD,EAAOC,CAAG;AAAA,EACnB,GAGAK,EAAU,UAAU,MAAMV,MAAa,UAAaF,MAAU,QAEvDY;AACT;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("./array/aggregate.cjs"),m=require("./array/alternate.cjs"),p=require("./array/chunk.cjs"),_=require("./array/compact.cjs"),d=require("./array/contains.cjs"),S=require("./array/every.cjs"),E=require("./array/filter.cjs"),f=require("./array/find.cjs"),I=require("./array/findIndex.cjs"),g=require("./array/findLast.cjs"),O=require("./array/flatten.cjs"),y=require("./array/group.cjs"),M=require("./array/list.cjs"),b=require("./array/map.cjs"),v=require("./array/pick.cjs"),G=require("./array/reduce.cjs"),h=require("./array/remoteList.cjs"),N=require("./array/search.cjs"),k=require("./array/select.cjs"),P=require("./array/shift.cjs"),x=require("./array/some.cjs"),C=require("./array/sort.cjs"),T=require("./array/arrange.cjs"),A=require("./array/substitute.cjs"),D=require("./array/uniq.cjs"),B=require("./date/expires.cjs"),L=require("./date/interval.cjs"),w=require("./date/timeDiff.cjs"),U=require("./function/assert.cjs"),F=require("./function/assertParams.cjs"),J=require("./function/attempt.cjs"),W=require("./function/compare.cjs"),j=require("./function/compareBy.cjs"),Y=require("./function/compose.cjs"),Z=require("./function/curry.cjs"),H=require("./function/debounce.cjs"),Q=require("./function/delay.cjs"),V=require("./function/fp.cjs"),z=require("./function/memo.cjs"),K=require("./function/once.cjs"),X=require("./function/parallel.cjs"),$=require("./function/pipe.cjs"),ee=require("./function/predict.cjs"),re=require("./function/proxy.cjs"),ie=require("./function/prune.cjs"),se=require("./function/retry.cjs"),te=require("./function/sleep.cjs"),ne=require("./function/throttle.cjs"),oe=require("./function/worker.cjs"),ce=require("./math/abs.cjs"),ue=require("./math/add.cjs"),ae=require("./math/allocate.cjs"),qe=require("./math/average.cjs"),le=require("./math/boil.cjs"),Re=require("./math/clamp.cjs"),me=require("./math/distribute.cjs"),pe=require("./math/divide.cjs"),_e=require("./math/max.cjs"),de=require("./math/median.cjs"),Se=require("./math/min.cjs"),Ee=require("./math/multiply.cjs"),fe=require("./math/range.cjs"),Ie=require("./math/rate.cjs"),ge=require("./math/round.cjs"),Oe=require("./math/subtract.cjs"),ye=require("./math/sum.cjs"),Me=require("./money/currency.cjs"),be=require("./money/exchange.cjs"),ve=require("./object/clone.cjs"),Ge=require("./object/diff.cjs"),he=require("./object/entries.cjs"),Ne=require("./object/keys.cjs"),ke=require("./object/merge.cjs"),Pe=require("./object/parseJSON.cjs"),xe=require("./object/path.cjs"),Ce=require("./object/seek.cjs"),Te=require("./object/values.cjs"),Ae=require("./random/draw.cjs"),De=require("./random/random.cjs"),Be=require("./random/shuffle.cjs"),Le=require("./random/uuid.cjs"),we=require("./string/camelCase.cjs"),Ue=require("./string/kebabCase.cjs"),Fe=require("./string/pascalCase.cjs"),Je=require("./string/similarity.cjs"),We=require("./string/snakeCase.cjs"),je=require("./string/truncate.cjs"),Ye=require("./typed/ge.cjs"),Ze=require("./typed/gt.cjs"),He=require("./typed/is.cjs"),e=require("./typed/isArray.cjs"),Qe=require("./typed/isBoolean.cjs"),r=require("./typed/isDate.cjs"),Ve=require("./typed/isDefined.cjs"),i=require("./typed/isEmpty.cjs"),s=require("./typed/isEqual.cjs"),ze=require("./typed/isEven.cjs"),t=require("./typed/isFunction.cjs"),Ke=require("./typed/isNegative.cjs"),n=require("./typed/isNil.cjs"),o=require("./typed/isNumber.cjs"),c=require("./typed/isObject.cjs"),Xe=require("./typed/isOdd.cjs"),$e=require("./typed/isPositive.cjs"),u=require("./typed/isPrimitive.cjs"),a=require("./typed/isPromise.cjs"),er=require("./typed/isRegex.cjs"),q=require("./typed/isString.cjs"),l=require("./typed/isWithin.cjs"),rr=require("./typed/isZero.cjs"),ir=require("./typed/le.cjs"),sr=require("./typed/lt.cjs"),tr=require("./typed/typeOf.cjs");exports.aggregate=R.aggregate;exports.alternate=m.alternate;exports.chunk=p.chunk;exports.compact=_.compact;exports.contains=d.contains;exports.every=S.every;exports.filter=E.filter;exports.find=f.find;exports.findIndex=I.findIndex;exports.findLast=g.findLast;exports.flatten=O.flatten;exports.group=y.group;exports.list=M.list;exports.map=b.map;exports.pick=v.pick;exports.reduce=G.reduce;exports.remoteList=h.remoteList;exports.search=N.search;exports.select=k.select;exports.shift=P.shift;exports.some=x.some;exports.sort=C.sort;exports.arrange=T.arrange;exports.substitute=A.substitute;exports.uniq=D.uniq;exports.expires=B.expires;exports.interval=L.interval;exports.timeDiff=w.timeDiff;exports.assert=U.assert;exports.assertParams=F.assertParams;exports.attempt=J.attempt;exports.compare=W.compare;exports.compareBy=j.compareBy;exports.compose=Y.compose;exports.curry=Z.curry;exports.debounce=H.debounce;exports.delay=Q.delay;exports.fp=V.fp;exports.memo=z.memo;exports.once=K.once;exports.parallel=X.parallel;exports.pipe=$.pipe;exports.predict=ee.predict;exports.proxy=re.proxy;exports.prune=ie.prune;exports.retry=se.retry;exports.sleep=te.sleep;exports.throttle=ne.throttle;exports.worker=oe.worker;exports.abs=ce.abs;exports.add=ue.add;exports.allocate=ae.allocate;exports.average=qe.average;exports.boil=le.boil;exports.clamp=Re.clamp;exports.distribute=me.distribute;exports.divide=pe.divide;exports.max=_e.max;exports.median=de.median;exports.min=Se.min;exports.multiply=Ee.multiply;exports.range=fe.range;exports.rate=Ie.rate;exports.round=ge.round;exports.subtract=Oe.subtract;exports.sum=ye.sum;exports.currency=Me.currency;exports.exchange=be.exchange;exports.clone=ve.clone;exports.diff=Ge.diff;exports.entries=he.entries;exports.keys=Ne.keys;exports.merge=ke.merge;exports.parseJSON=Pe.parseJSON;exports.path=xe.path;exports.seek=Ce.seek;exports.values=Te.values;exports.draw=Ae.draw;exports.random=De.random;exports.shuffle=Be.shuffle;exports.uuid=Le.uuid;exports.camelCase=we.camelCase;exports.kebabCase=Ue.kebabCase;exports.pascalCase=Fe.pascalCase;exports.similarity=Je.similarity;exports.snakeCase=We.snakeCase;exports.truncate=je.truncate;exports.ge=Ye.ge;exports.gt=Ze.gt;exports.is=He.is;exports.IS_ARRAY_ERROR_MSG=e.IS_ARRAY_ERROR_MSG;exports.isArray=e.isArray;exports.isBoolean=Qe.isBoolean;exports.IS_DATE_ERROR_MSG=r.IS_DATE_ERROR_MSG;exports.isDate=r.isDate;exports.isDefined=Ve.isDefined;exports.IS_EMPTY_ERROR_MSG=i.IS_EMPTY_ERROR_MSG;exports.isEmpty=i.isEmpty;exports.IS_EQUAL_ERROR_MSG=s.IS_EQUAL_ERROR_MSG;exports.isEqual=s.isEqual;exports.isEven=ze.isEven;exports.IS_FUNCTION_ERROR_MSG=t.IS_FUNCTION_ERROR_MSG;exports.isFunction=t.isFunction;exports.isNegative=Ke.isNegative;exports.IS_NIL_ERROR_MSG=n.IS_NIL_ERROR_MSG;exports.isNil=n.isNil;exports.IS_NUMBER_ERROR_MSG=o.IS_NUMBER_ERROR_MSG;exports.isNumber=o.isNumber;exports.IS_OBJECT_ERROR_MSG=c.IS_OBJECT_ERROR_MSG;exports.isObject=c.isObject;exports.isOdd=Xe.isOdd;exports.isPositive=$e.isPositive;exports.IS_PRIMITIVE_ERROR_MSG=u.IS_PRIMITIVE_ERROR_MSG;exports.isPrimitive=u.isPrimitive;exports.IS_PROMISE_ERROR_MSG=a.IS_PROMISE_ERROR_MSG;exports.isPromise=a.isPromise;exports.isRegex=er.isRegex;exports.IS_STRING_ERROR_MSG=q.IS_STRING_ERROR_MSG;exports.isString=q.isString;exports.IS_WITHIN_ERROR_MSG=l.IS_WITHIN_ERROR_MSG;exports.isWithin=l.isWithin;exports.isZero=rr.isZero;exports.le=ir.le;exports.lt=sr.lt;exports.typeOf=tr.typeOf;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|