es-toolkit 1.13.1-dev.354 → 1.13.1-dev.355
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/_chunk/index-CwRt_M.js +0 -1
- package/dist/_chunk/isPlainObject-bK22pA.js +0 -1
- package/dist/_chunk/randomInt-CF7bZK.js +0 -1
- package/dist/_chunk/union-CdQeDK.js +0 -1
- package/dist/array/chunk.mjs +0 -1
- package/dist/array/compact.mjs +0 -1
- package/dist/array/countBy.mjs +0 -1
- package/dist/array/difference.mjs +0 -1
- package/dist/array/differenceBy.mjs +0 -1
- package/dist/array/differenceWith.mjs +0 -1
- package/dist/array/drop.mjs +0 -1
- package/dist/array/dropRight.mjs +0 -1
- package/dist/array/dropRightWhile.mjs +0 -1
- package/dist/array/dropWhile.mjs +0 -1
- package/dist/array/fill.mjs +0 -1
- package/dist/array/flatMap.mjs +0 -1
- package/dist/array/flatten.mjs +0 -1
- package/dist/array/flattenDeep.mjs +0 -1
- package/dist/array/forEachRight.mjs +0 -1
- package/dist/array/groupBy.mjs +0 -1
- package/dist/array/head.mjs +0 -1
- package/dist/array/index.js +0 -1
- package/dist/array/index.mjs +0 -1
- package/dist/array/initial.mjs +0 -1
- package/dist/array/intersection.mjs +0 -1
- package/dist/array/intersectionBy.mjs +0 -1
- package/dist/array/intersectionWith.mjs +0 -1
- package/dist/array/keyBy.mjs +0 -1
- package/dist/array/last.mjs +0 -1
- package/dist/array/maxBy.mjs +0 -1
- package/dist/array/minBy.mjs +0 -1
- package/dist/array/orderBy.mjs +0 -1
- package/dist/array/partition.mjs +0 -1
- package/dist/array/sample.mjs +0 -1
- package/dist/array/sampleSize.mjs +0 -1
- package/dist/array/shuffle.mjs +0 -1
- package/dist/array/tail.mjs +0 -1
- package/dist/array/take.mjs +0 -1
- package/dist/array/takeRight.mjs +0 -1
- package/dist/array/takeRightWhile.mjs +0 -1
- package/dist/array/takeWhile.mjs +0 -1
- package/dist/array/toFilled.mjs +0 -1
- package/dist/array/union.mjs +0 -1
- package/dist/array/unionBy.mjs +0 -1
- package/dist/array/unionWith.mjs +0 -1
- package/dist/array/uniq.mjs +0 -1
- package/dist/array/uniqBy.mjs +0 -1
- package/dist/array/uniqWith.mjs +0 -1
- package/dist/array/unzip.mjs +0 -1
- package/dist/array/unzipWith.mjs +0 -1
- package/dist/array/without.mjs +0 -1
- package/dist/array/xor.mjs +0 -1
- package/dist/array/xorBy.mjs +0 -1
- package/dist/array/xorWith.mjs +0 -1
- package/dist/array/zip.mjs +0 -1
- package/dist/array/zipObject.mjs +0 -1
- package/dist/array/zipWith.mjs +0 -1
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/getTag.mjs +0 -1
- package/dist/compat/_internal/identity.mjs +0 -1
- package/dist/compat/_internal/isArrayMatch.mjs +0 -1
- package/dist/compat/_internal/isDeepKey.mjs +0 -1
- package/dist/compat/_internal/isIndex.mjs +0 -1
- package/dist/compat/_internal/isMapMatch.mjs +0 -1
- package/dist/compat/_internal/isSetMatch.mjs +0 -1
- package/dist/compat/_internal/toPath.mjs +0 -1
- package/dist/compat/array/chunk.mjs +0 -1
- package/dist/compat/array/concat.mjs +0 -1
- package/dist/compat/array/difference.mjs +0 -1
- package/dist/compat/array/fill.mjs +0 -1
- package/dist/compat/array/zipObjectDeep.mjs +0 -1
- package/dist/compat/index.js +0 -1
- package/dist/compat/index.mjs +0 -1
- package/dist/compat/math/max.mjs +0 -1
- package/dist/compat/math/min.mjs +0 -1
- package/dist/compat/object/get.mjs +0 -1
- package/dist/compat/object/mapKeys.mjs +0 -1
- package/dist/compat/object/property.mjs +0 -1
- package/dist/compat/object/set.mjs +0 -1
- package/dist/compat/predicate/isArray.mjs +0 -1
- package/dist/compat/predicate/isMatch.mjs +0 -1
- package/dist/compat/predicate/isPlainObject.mjs +0 -1
- package/dist/compat/predicate/isTypedArray.mjs +0 -1
- package/dist/compat/predicate/matches.mjs +0 -1
- package/dist/compat/string/endsWith.mjs +0 -1
- package/dist/compat/string/startsWith.mjs +0 -1
- package/dist/error/AbortError.mjs +0 -1
- package/dist/error/TimeoutError.mjs +0 -1
- package/dist/function/after.mjs +0 -1
- package/dist/function/before.mjs +0 -1
- package/dist/function/debounce.mjs +0 -1
- package/dist/function/index.js +0 -1
- package/dist/function/index.mjs +0 -1
- package/dist/function/negate.mjs +0 -1
- package/dist/function/noop.mjs +0 -1
- package/dist/function/once.mjs +0 -1
- package/dist/function/throttle.mjs +0 -1
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
- package/dist/math/clamp.mjs +0 -1
- package/dist/math/inRange.mjs +0 -1
- package/dist/math/index.js +0 -1
- package/dist/math/index.mjs +0 -1
- package/dist/math/mean.mjs +0 -1
- package/dist/math/meanBy.mjs +0 -1
- package/dist/math/random.mjs +0 -1
- package/dist/math/randomInt.mjs +0 -1
- package/dist/math/range.mjs +0 -1
- package/dist/math/round.mjs +0 -1
- package/dist/math/sum.mjs +0 -1
- package/dist/math/sumBy.mjs +0 -1
- package/dist/object/clone.mjs +0 -1
- package/dist/object/cloneDeep.mjs +0 -1
- package/dist/object/flattenObject.mjs +0 -1
- package/dist/object/index.js +0 -1
- package/dist/object/index.mjs +0 -1
- package/dist/object/invert.mjs +0 -1
- package/dist/object/mapKeys.mjs +0 -1
- package/dist/object/mapValues.mjs +0 -1
- package/dist/object/omit.mjs +0 -1
- package/dist/object/omitBy.mjs +0 -1
- package/dist/object/pick.mjs +0 -1
- package/dist/object/pickBy.mjs +0 -1
- package/dist/predicate/index.js +0 -1
- package/dist/predicate/index.mjs +0 -1
- package/dist/predicate/isArguments.mjs +0 -1
- package/dist/predicate/isArrayLike.mjs +0 -1
- package/dist/predicate/isEqual.mjs +0 -1
- package/dist/predicate/isFunction.mjs +0 -1
- package/dist/predicate/isLength.mjs +0 -1
- package/dist/predicate/isNil.mjs +0 -1
- package/dist/predicate/isNotNil.mjs +0 -1
- package/dist/predicate/isNull.mjs +0 -1
- package/dist/predicate/isObjectLike.mjs +0 -1
- package/dist/predicate/isPlainObject.mjs +0 -1
- package/dist/predicate/isPrimitive.mjs +0 -1
- package/dist/predicate/isTypedArray.mjs +0 -1
- package/dist/predicate/isUndefined.mjs +0 -1
- package/dist/promise/delay.mjs +0 -1
- package/dist/promise/index.js +0 -1
- package/dist/promise/index.mjs +0 -1
- package/dist/promise/timeout.mjs +0 -1
- package/dist/promise/withTimeout.mjs +0 -1
- package/dist/string/_internal/getWords.mjs +0 -1
- package/dist/string/camelCase.mjs +0 -1
- package/dist/string/capitalize.mjs +0 -1
- package/dist/string/index.js +0 -1
- package/dist/string/index.mjs +0 -1
- package/dist/string/kebabCase.mjs +0 -1
- package/dist/string/lowerCase.mjs +0 -1
- package/dist/string/snakeCase.mjs +0 -1
- package/dist/string/startCase.mjs +0 -1
- package/package.json +1 -1
- package/dist/_chunk/index-CwRt_M.js.map +0 -1
- package/dist/_chunk/isPlainObject-bK22pA.js.map +0 -1
- package/dist/_chunk/randomInt-CF7bZK.js.map +0 -1
- package/dist/_chunk/union-CdQeDK.js.map +0 -1
- package/dist/array/chunk.mjs.map +0 -1
- package/dist/array/compact.mjs.map +0 -1
- package/dist/array/countBy.mjs.map +0 -1
- package/dist/array/difference.mjs.map +0 -1
- package/dist/array/differenceBy.mjs.map +0 -1
- package/dist/array/differenceWith.mjs.map +0 -1
- package/dist/array/drop.mjs.map +0 -1
- package/dist/array/dropRight.mjs.map +0 -1
- package/dist/array/dropRightWhile.mjs.map +0 -1
- package/dist/array/dropWhile.mjs.map +0 -1
- package/dist/array/fill.mjs.map +0 -1
- package/dist/array/flatMap.mjs.map +0 -1
- package/dist/array/flatten.mjs.map +0 -1
- package/dist/array/flattenDeep.mjs.map +0 -1
- package/dist/array/forEachRight.mjs.map +0 -1
- package/dist/array/groupBy.mjs.map +0 -1
- package/dist/array/head.mjs.map +0 -1
- package/dist/array/index.js.map +0 -1
- package/dist/array/index.mjs.map +0 -1
- package/dist/array/initial.mjs.map +0 -1
- package/dist/array/intersection.mjs.map +0 -1
- package/dist/array/intersectionBy.mjs.map +0 -1
- package/dist/array/intersectionWith.mjs.map +0 -1
- package/dist/array/keyBy.mjs.map +0 -1
- package/dist/array/last.mjs.map +0 -1
- package/dist/array/maxBy.mjs.map +0 -1
- package/dist/array/minBy.mjs.map +0 -1
- package/dist/array/orderBy.mjs.map +0 -1
- package/dist/array/partition.mjs.map +0 -1
- package/dist/array/sample.mjs.map +0 -1
- package/dist/array/sampleSize.mjs.map +0 -1
- package/dist/array/shuffle.mjs.map +0 -1
- package/dist/array/tail.mjs.map +0 -1
- package/dist/array/take.mjs.map +0 -1
- package/dist/array/takeRight.mjs.map +0 -1
- package/dist/array/takeRightWhile.mjs.map +0 -1
- package/dist/array/takeWhile.mjs.map +0 -1
- package/dist/array/toFilled.mjs.map +0 -1
- package/dist/array/union.mjs.map +0 -1
- package/dist/array/unionBy.mjs.map +0 -1
- package/dist/array/unionWith.mjs.map +0 -1
- package/dist/array/uniq.mjs.map +0 -1
- package/dist/array/uniqBy.mjs.map +0 -1
- package/dist/array/uniqWith.mjs.map +0 -1
- package/dist/array/unzip.mjs.map +0 -1
- package/dist/array/unzipWith.mjs.map +0 -1
- package/dist/array/without.mjs.map +0 -1
- package/dist/array/xor.mjs.map +0 -1
- package/dist/array/xorBy.mjs.map +0 -1
- package/dist/array/xorWith.mjs.map +0 -1
- package/dist/array/zip.mjs.map +0 -1
- package/dist/array/zipObject.mjs.map +0 -1
- package/dist/array/zipWith.mjs.map +0 -1
- package/dist/compat/_internal/getTag.mjs.map +0 -1
- package/dist/compat/_internal/identity.mjs.map +0 -1
- package/dist/compat/_internal/isArrayMatch.mjs.map +0 -1
- package/dist/compat/_internal/isDeepKey.mjs.map +0 -1
- package/dist/compat/_internal/isIndex.mjs.map +0 -1
- package/dist/compat/_internal/isMapMatch.mjs.map +0 -1
- package/dist/compat/_internal/isSetMatch.mjs.map +0 -1
- package/dist/compat/_internal/toPath.mjs.map +0 -1
- package/dist/compat/array/chunk.mjs.map +0 -1
- package/dist/compat/array/concat.mjs.map +0 -1
- package/dist/compat/array/difference.mjs.map +0 -1
- package/dist/compat/array/fill.mjs.map +0 -1
- package/dist/compat/array/zipObjectDeep.mjs.map +0 -1
- package/dist/compat/index.js.map +0 -1
- package/dist/compat/index.mjs.map +0 -1
- package/dist/compat/math/max.mjs.map +0 -1
- package/dist/compat/math/min.mjs.map +0 -1
- package/dist/compat/object/get.mjs.map +0 -1
- package/dist/compat/object/mapKeys.mjs.map +0 -1
- package/dist/compat/object/property.mjs.map +0 -1
- package/dist/compat/object/set.mjs.map +0 -1
- package/dist/compat/predicate/isArray.mjs.map +0 -1
- package/dist/compat/predicate/isMatch.mjs.map +0 -1
- package/dist/compat/predicate/isPlainObject.mjs.map +0 -1
- package/dist/compat/predicate/isTypedArray.mjs.map +0 -1
- package/dist/compat/predicate/matches.mjs.map +0 -1
- package/dist/compat/string/endsWith.mjs.map +0 -1
- package/dist/compat/string/startsWith.mjs.map +0 -1
- package/dist/error/AbortError.mjs.map +0 -1
- package/dist/error/TimeoutError.mjs.map +0 -1
- package/dist/function/after.mjs.map +0 -1
- package/dist/function/before.mjs.map +0 -1
- package/dist/function/debounce.mjs.map +0 -1
- package/dist/function/index.js.map +0 -1
- package/dist/function/index.mjs.map +0 -1
- package/dist/function/negate.mjs.map +0 -1
- package/dist/function/noop.mjs.map +0 -1
- package/dist/function/once.mjs.map +0 -1
- package/dist/function/throttle.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/math/clamp.mjs.map +0 -1
- package/dist/math/inRange.mjs.map +0 -1
- package/dist/math/index.js.map +0 -1
- package/dist/math/index.mjs.map +0 -1
- package/dist/math/mean.mjs.map +0 -1
- package/dist/math/meanBy.mjs.map +0 -1
- package/dist/math/random.mjs.map +0 -1
- package/dist/math/randomInt.mjs.map +0 -1
- package/dist/math/range.mjs.map +0 -1
- package/dist/math/round.mjs.map +0 -1
- package/dist/math/sum.mjs.map +0 -1
- package/dist/math/sumBy.mjs.map +0 -1
- package/dist/object/clone.mjs.map +0 -1
- package/dist/object/cloneDeep.mjs.map +0 -1
- package/dist/object/flattenObject.mjs.map +0 -1
- package/dist/object/index.js.map +0 -1
- package/dist/object/index.mjs.map +0 -1
- package/dist/object/invert.mjs.map +0 -1
- package/dist/object/mapKeys.mjs.map +0 -1
- package/dist/object/mapValues.mjs.map +0 -1
- package/dist/object/omit.mjs.map +0 -1
- package/dist/object/omitBy.mjs.map +0 -1
- package/dist/object/pick.mjs.map +0 -1
- package/dist/object/pickBy.mjs.map +0 -1
- package/dist/predicate/index.js.map +0 -1
- package/dist/predicate/index.mjs.map +0 -1
- package/dist/predicate/isArguments.mjs.map +0 -1
- package/dist/predicate/isArrayLike.mjs.map +0 -1
- package/dist/predicate/isEqual.mjs.map +0 -1
- package/dist/predicate/isFunction.mjs.map +0 -1
- package/dist/predicate/isLength.mjs.map +0 -1
- package/dist/predicate/isNil.mjs.map +0 -1
- package/dist/predicate/isNotNil.mjs.map +0 -1
- package/dist/predicate/isNull.mjs.map +0 -1
- package/dist/predicate/isObjectLike.mjs.map +0 -1
- package/dist/predicate/isPlainObject.mjs.map +0 -1
- package/dist/predicate/isPrimitive.mjs.map +0 -1
- package/dist/predicate/isTypedArray.mjs.map +0 -1
- package/dist/predicate/isUndefined.mjs.map +0 -1
- package/dist/promise/delay.mjs.map +0 -1
- package/dist/promise/index.js.map +0 -1
- package/dist/promise/index.mjs.map +0 -1
- package/dist/promise/timeout.mjs.map +0 -1
- package/dist/promise/withTimeout.mjs.map +0 -1
- package/dist/string/_internal/getWords.mjs.map +0 -1
- package/dist/string/camelCase.mjs.map +0 -1
- package/dist/string/capitalize.mjs.map +0 -1
- package/dist/string/index.js.map +0 -1
- package/dist/string/index.mjs.map +0 -1
- package/dist/string/kebabCase.mjs.map +0 -1
- package/dist/string/lowerCase.mjs.map +0 -1
- package/dist/string/snakeCase.mjs.map +0 -1
- package/dist/string/startCase.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zipObject.mjs","sources":["../../src/array/zipObject.ts"],"sourcesContent":["/**\n * Combines two arrays, one of property names and one of corresponding values, into a single object.\n *\n * This function takes two arrays: one containing property names and another containing corresponding values.\n * It returns a new object where the property names from the first array are keys, and the corresponding elements\n * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will\n * have `undefined` as their values.\n *\n * @template P - The type of elements in the array.\n * @template V - The type of elements in the array.\n * @param {P[]} keys - An array of property names.\n * @param {V[]} values - An array of values corresponding to the property names.\n * @returns {{ [K in P]: V }} A new object composed of the given property names and values.\n *\n * @example\n * const keys = ['a', 'b', 'c'];\n * const values = [1, 2, 3];\n * const result = zipObject(keys, values);\n * // result will be { a: 1, b: 2, c: 3 }\n *\n * const keys2 = ['a', 'b', 'c'];\n * const values2 = [1, 2];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2, c: undefined }\n *\n * const keys2 = ['a', 'b'];\n * const values2 = [1, 2, 3];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2 }\n */\nexport function zipObject<P extends PropertyKey, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n\n for (let i = 0; i < keys.length; i++) {\n result[keys[i]] = values[i];\n }\n\n return result;\n}\n"],"names":[],"mappings":"AA8BgB,SAAA,SAAS,CAA2B,IAAS,EAAE,MAAW,EAAA;IACxE,MAAM,MAAM,GAAG,EAAqB,CAAC;AAErC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;KAC7B;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zipWith.mjs","sources":["../../src/array/zipWith.ts"],"sourcesContent":["/**\n * Combines multiple arrays into a single array using a custom combiner function.\n *\n * This function takes multiple arrays and a combiner function, and returns a new array where each element\n * is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @template T - The type of elements in the first array.\n * @template U - The type of elements in the second array (optional).\n * @template V - The type of elements in the third array (optional).\n * @template W - The type of elements in the fourth array (optional).\n * @template R - The type of elements in the resulting array.\n * @param {T[]} arr1 - The first array to zip.\n * @param {U[]} [arr2] - The second array to zip (optional).\n * @param {V[]} [arr3] - The third array to zip (optional).\n * @param {W[]} [arr4] - The fourth array to zip (optional).\n * @param {(...items: T[]) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.\n * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @example\n * // Example usage with two arrays:\n * const arr1 = [1, 2, 3];\n * const arr2 = [4, 5, 6];\n * const result = zipWith(arr1, arr2, (a, b) => a + b);\n * // result will be [5, 7, 9]\n *\n * @example\n * // Example usage with three arrays:\n * const arr1 = [1, 2];\n * const arr2 = [3, 4];\n * const arr3 = [5, 6];\n * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);\n * // result will be [`135`, `246`]\n */\nexport function zipWith<T, R>(arr1: readonly T[], combine: (item: T) => R): R[];\nexport function zipWith<T, U, R>(arr1: readonly T[], arr2: readonly U[], combine: (item1: T, item2: U) => R): R[];\nexport function zipWith<T, U, V, R>(\n arr1: readonly T[],\n arr2: readonly U[],\n arr3: readonly V[],\n combine: (item1: T, item2: U, item3: V) => R\n): R[];\nexport function zipWith<T, U, V, W, R>(\n arr1: readonly T[],\n arr2: readonly U[],\n arr3: readonly V[],\n arr4: readonly W[],\n combine: (item1: T, item2: U, item3: V, item4: W) => R\n): R[];\nexport function zipWith<T, R>(arr1: readonly T[], ...rest: any[]): R[] {\n const arrs = [arr1, ...rest.slice(0, -1)];\n const combine = rest[rest.length - 1] as (...items: T[]) => R;\n\n const result: R[] = [];\n const maxIndex = Math.max(...arrs.map(arr => arr.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const elements: T[] = arrs.map(arr => arr[i]);\n result.push(combine(...elements));\n }\n\n return result;\n}\n"],"names":[],"mappings":"SAgDgB,OAAO,CAAO,IAAkB,EAAE,GAAG,IAAW,EAAA;AAC9D,IAAA,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAyB,CAAC;IAE9D,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1D,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;AACjC,QAAA,MAAM,QAAQ,GAAQ,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;KACnC;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getTag.mjs","sources":["../../../src/compat/_internal/getTag.ts"],"sourcesContent":["/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {T} value The value to query.\n * @returns {string} Returns the `Object.prototype.toString.call` result.\n */\nexport function getTag<T>(value: T) {\n if (value == null) {\n return value === undefined ? '[object Undefined]' : '[object Null]';\n }\n return Object.prototype.toString.call(value);\n}\n"],"names":[],"mappings":"AAOM,SAAU,MAAM,CAAI,KAAQ,EAAA;AAChC,IAAA,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,KAAK,KAAK,SAAS,GAAG,oBAAoB,GAAG,eAAe,CAAC;KACrE;IACD,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.mjs","sources":["../../../src/compat/_internal/identity.ts"],"sourcesContent":["export function identity<T>(x: T) {\n return x;\n}"],"names":[],"mappings":"AAAM,SAAU,QAAQ,CAAI,CAAI,EAAA;AAC9B,IAAA,OAAO,CAAC,CAAC;AACX;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isArrayMatch.mjs","sources":["../../../src/compat/_internal/isArrayMatch.ts"],"sourcesContent":["import { isMatch } from '../predicate/isMatch.ts';\n\nexport function isArrayMatch(target: unknown, source: readonly unknown[]) {\n if (source.length === 0) {\n return true;\n }\n\n if (!Array.isArray(target)) {\n return false;\n }\n\n const countedIndex = new Set<number>();\n\n for (let i = 0; i < source.length; i++) {\n const sourceItem = source[i];\n const index = target.findIndex((targetItem, index) => {\n return isMatch(targetItem, sourceItem) && !countedIndex.has(index);\n });\n\n if (index === -1) {\n return false;\n }\n\n countedIndex.add(index);\n }\n\n return true;\n}\n"],"names":[],"mappings":";;AAEgB,SAAA,YAAY,CAAC,MAAe,EAAE,MAA0B,EAAA;AACtE,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,QAAA,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AAC1B,QAAA,OAAO,KAAK,CAAC;KACd;AAED,IAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;AAEvC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACtC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,KAAK,KAAI;AACnD,YAAA,OAAO,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACrE,SAAC,CAAC,CAAC;AAEH,QAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;AAChB,YAAA,OAAO,KAAK,CAAC;SACd;AAED,QAAA,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACzB;AAED,IAAA,OAAO,IAAI,CAAC;AACd;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isDeepKey.mjs","sources":["../../../src/compat/_internal/isDeepKey.ts"],"sourcesContent":["const IS_PLAIN = /^\\w*$/;\nconst IS_DEEP = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\n\n/**\n * Checks if a given key is a deep key.\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @param {PropertyKey} key - The key to check.\n * @returns {boolean} - Returns true if the key is a deep key, otherwise false.\n *\n * Examples:\n *\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // false\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n */\nexport function isDeepKey(key: PropertyKey): boolean {\n switch (typeof key) {\n case 'number':\n case 'symbol': {\n return false;\n }\n case 'string': {\n return !IS_PLAIN.test(key) && IS_DEEP.test(key);\n }\n }\n}\n"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC;AACzB,MAAM,OAAO,GAAG,kDAAkD,CAAC;AAmB7D,SAAU,SAAS,CAAC,GAAgB,EAAA;IACxC,QAAQ,OAAO,GAAG;AAChB,QAAA,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,EAAE;AACb,YAAA,OAAO,KAAK,CAAC;SACd;QACD,KAAK,QAAQ,EAAE;AACb,YAAA,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACjD;KACF;AACH;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isIndex.mjs","sources":["../../../src/compat/_internal/isIndex.ts"],"sourcesContent":["const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/\n\nexport function isIndex(value: PropertyKey) {\n switch (typeof value) {\n case 'number': {\n return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;\n }\n case 'symbol': {\n return false;\n }\n case 'string': {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG,kBAAkB,CAAA;AAExC,SAAU,OAAO,CAAC,KAAkB,EAAA;IACxC,QAAQ,OAAO,KAAK;QAClB,KAAK,QAAQ,EAAE;AACb,YAAA,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC;SACjF;QACD,KAAK,QAAQ,EAAE;AACb,YAAA,OAAO,KAAK,CAAC;SACd;QACD,KAAK,QAAQ,EAAE;AACb,YAAA,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACxC;KACF;AACH;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isMapMatch.mjs","sources":["../../../src/compat/_internal/isMapMatch.ts"],"sourcesContent":["import { isMatch } from '../predicate/isMatch.ts';\n\nexport function isMapMatch(target: unknown, source: Map<any, any>) {\n if (source.size === 0) {\n return true;\n }\n\n if (!(target instanceof Map)) {\n return false;\n }\n\n for (const [key, value] of source.entries()) {\n if (!isMatch(target.get(key), value)) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":[],"mappings":";;AAEgB,SAAA,UAAU,CAAC,MAAe,EAAE,MAAqB,EAAA;AAC/D,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,IAAI,EAAE,MAAM,YAAY,GAAG,CAAC,EAAE;AAC5B,QAAA,OAAO,KAAK,CAAC;KACd;AAED,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE;AAC3C,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE;AACpC,YAAA,OAAO,KAAK,CAAC;SACd;KACF;AAED,IAAA,OAAO,IAAI,CAAC;AACd;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isSetMatch.mjs","sources":["../../../src/compat/_internal/isSetMatch.ts"],"sourcesContent":["import { isArrayMatch } from './isArrayMatch.ts';\n\nexport function isSetMatch(target: unknown, source: Set<any>) {\n if (source.size === 0) {\n return true;\n }\n\n if (!(target instanceof Set)) {\n return false;\n }\n\n return isArrayMatch([...target], [...source]);\n}\n"],"names":[],"mappings":";;AAEgB,SAAA,UAAU,CAAC,MAAe,EAAE,MAAgB,EAAA;AAC1D,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,IAAI,EAAE,MAAM,YAAY,GAAG,CAAC,EAAE;AAC5B,QAAA,OAAO,KAAK,CAAC;KACd;AAED,IAAA,OAAO,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAChD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toPath.mjs","sources":["../../../src/compat/_internal/toPath.ts"],"sourcesContent":["/**\n * Converts a deep key string into an array of path segments.\n *\n * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n *\n * @param {string} deepKey - The deep key string to convert.\n * @returns {string[]} An array of strings, each representing a segment of the path.\n *\n * Examples:\n *\n * toPath('a.b.c') // Returns ['a', 'b', 'c']\n * toPath('a[b][c]') // Returns ['a', 'b', 'c']\n * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n * toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n * toPath('') // Returns []\n * toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n */\nexport function toPath(deepKey: string): string[] {\n const ESCAPE_REGEXP = /\\\\(\\\\)?/g;\n const PROPERTY_REGEXP = RegExp(\n // Match anything that isn't a dot or bracket.\n '[^.[\\\\]]+' +\n '|' +\n // Or match property names within brackets.\n '\\\\[(?:' +\n // Match a non-string expression.\n '([^\"\\'][^[]*)' +\n '|' +\n // Or match strings (supports escaping characters).\n '([\"\\'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2' +\n ')\\\\]' +\n '|' +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n '(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))',\n 'g'\n );\n\n const result: string[] = [];\n\n if (deepKey[0] === '.') {\n result.push('');\n }\n\n let match: RegExpExecArray | null;\n let lastIndex = 0;\n\n while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {\n let key = match[0];\n const expr = match[1];\n const quote = match[2];\n const substr = match[3];\n\n if (quote) {\n key = substr.replace(ESCAPE_REGEXP, '$1');\n } else if (expr) {\n key = expr;\n }\n\n result.push(key);\n\n if (PROPERTY_REGEXP.lastIndex === lastIndex) {\n PROPERTY_REGEXP.lastIndex++;\n } else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AAC;SACvC;KACF;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.mjs","sources":["../../../src/compat/array/chunk.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n"],"names":["chunkToolkit"],"mappings":";;SAyBgB,KAAK,CAAI,GAAiB,EAAE,IAAI,GAAG,CAAC,EAAA;AAClD,IAAA,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAErC,IAAA,IAAI,IAAI,KAAK,CAAC,EAAE;AACd,QAAA,OAAO,EAAE,CAAC;KACX;AAED,IAAA,OAAOA,OAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACjC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concat.mjs","sources":["../../../src/compat/array/concat.ts"],"sourcesContent":["import { flatten } from '../../array/flatten.ts';\n\n/**\n * Concatenates multiple arrays and values into a single array.\n *\n * @template T The type of elements in the array.\n * @param {...(T | T[])} values - The values and/or arrays to concatenate.\n * @returns {T[]} A new array containing all the input values.\n *\n * @example\n * // Concatenate individual values\n * concat(1, 2, 3);\n * // returns [1, 2, 3]\n *\n * @example\n * // Concatenate arrays of values\n * concat([1, 2], [3, 4]);\n * // returns [1, 2, 3, 4]\n *\n * @example\n * // Concatenate a mix of individual values and arrays\n * concat(1, [2, 3], 4);\n * // returns [1, 2, 3, 4]\n *\n * @example\n * // Concatenate nested arrays\n * concat([1, [2, 3]], 4);\n * // returns [1, [2, 3], 4]\n */\nexport function concat<T>(...values: Array<T | readonly T[]>): T[] {\n return flatten(values) as T[];\n}\n"],"names":[],"mappings":";;AA6BgB,SAAA,MAAM,CAAI,GAAG,MAA+B,EAAA;AAC1D,IAAA,OAAO,OAAO,CAAC,MAAM,CAAQ,CAAC;AAChC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"difference.mjs","sources":["../../../src/compat/array/difference.ts"],"sourcesContent":["import { difference as differenceToolkit } from '../../array/difference.ts';\nimport { flatten } from '../../array/flatten.ts';\n\nexport function difference<T>(arr: readonly T[], ...values: Array<readonly T[]>): T[] {\n const arr1 = arr;\n const arr2 = flatten(values);\n\n return differenceToolkit(arr1, arr2);\n}"],"names":["differenceToolkit"],"mappings":";;;SAGgB,UAAU,CAAI,GAAiB,EAAE,GAAG,MAA2B,EAAA;IAC7E,MAAM,IAAI,GAAG,GAAG,CAAC;AACjB,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,IAAA,OAAOA,YAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fill.mjs","sources":["../../../src/compat/array/fill.ts"],"sourcesContent":["import { fill as fillToolkit } from '../../array/fill.ts';\n\n/**\n * Fills elements of an array with a specified value from the start position up to, but not including, the end position.\n *\n * This function mutates the original array and replaces its elements with the provided value, starting from the specified\n * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the\n * entire array.\n *\n * @template T, U, S, V\n * @param {Array<T | U>} array - The array to fill.\n * @param {U} value - The value to fill the array with.\n * @param {S} [start=0] - The start position. Defaults to 0.\n * @param {V} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | U>} The array with the filled values.\n *\n * @example\n * const array = [1, 2, 3];\n * const result = fill(array, 'a');\n * // => ['a', 'a', 'a']\n *\n * const result = fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * const result = fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n *\n * const result = fill(array, '*', -2, -1);\n * // => [1, '*', 3]\n */\nexport function fill<T>(array: unknown[], value?: T): T[];\nexport function fill<T, U, S>(array: Array<T | U>, value: U, start: S): Array<T | U>;\nexport function fill<T, U, S, V>(array: Array<T | U>, value: U, start: S, end: V): Array<T | U>;\nexport function fill<T, U>(array: Array<T | U>, value: U, start = 0, end = array.length): Array<T | U> {\n start = Math.floor(start);\n end = Math.floor(end);\n\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n\n return fillToolkit(array, value, start, end);\n}\n"],"names":["fillToolkit"],"mappings":";;AAiCgB,SAAA,IAAI,CAAO,KAAmB,EAAE,KAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAA;AACrF,IAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1B,IAAA,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtB,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,CAAC,CAAC;KACX;IACD,IAAI,CAAC,GAAG,EAAE;QACR,GAAG,GAAG,CAAC,CAAC;KACT;IAED,OAAOA,MAAW,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/C;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zipObjectDeep.mjs","sources":["../../../src/compat/array/zipObjectDeep.ts"],"sourcesContent":["import { zip } from \"../../array/zip.ts\";\nimport { set } from \"../object/set.ts\";\n\n/**\n * Creates a deeply nested object given arrays of paths and values.\n *\n * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.\n * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.\n * Paths can be dot-separated strings or arrays of property names.\n * \n * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.\n *\n * @template V - The type of elements in the array.\n * @param {P[] | P[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.\n * @param {V[]} values - An array of values corresponding to the property paths.\n * @returns {object} A new object composed of the given property paths and values.\n *\n * @example\n * const paths = ['a.b.c', 'd.e.f'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n *\n * @example\n * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n * \n * @example\n * const paths = ['a.b[0].c', 'a.b[1].d'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\nexport function zipObjectDeep<P extends PropertyKey, V>(keys: P[] | P[][], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n const zipped = zip<P | P[], V>(keys, values);\n\n for (let i = 0; i < zipped.length; i++) {\n const [key, value] = zipped[i];\n\n if (key != null) {\n set(result, key, value);\n }\n }\n\n return result;\n}\n"],"names":[],"mappings":";;;AAmCgB,SAAA,aAAa,CAA2B,IAAiB,EAAE,MAAW,EAAA;IACpF,MAAM,MAAM,GAAG,EAAqB,CAAC;IACrC,MAAM,MAAM,GAAG,GAAG,CAAa,IAAI,EAAE,MAAM,CAAC,CAAC;AAE7C,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAE/B,QAAA,IAAI,GAAG,IAAI,IAAI,EAAE;AACf,YAAA,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;SACzB;KACF;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/compat/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/compat/array/chunk.ts","../../src/compat/array/concat.ts","../../src/compat/array/difference.ts","../../src/compat/array/fill.ts","../../src/compat/_internal/isIndex.ts","../../src/compat/_internal/toPath.ts","../../src/compat/object/set.ts","../../src/compat/array/zipObjectDeep.ts","../../src/compat/_internal/isDeepKey.ts","../../src/compat/object/get.ts","../../src/compat/object/property.ts","../../src/compat/_internal/identity.ts","../../src/compat/object/mapKeys.ts","../../src/compat/predicate/isPlainObject.ts","../../src/compat/predicate/isArray.ts","../../src/compat/predicate/isTypedArray.ts","../../src/compat/_internal/isArrayMatch.ts","../../src/compat/_internal/isMapMatch.ts","../../src/compat/_internal/isSetMatch.ts","../../src/compat/predicate/isMatch.ts","../../src/compat/predicate/matches.ts","../../src/compat/string/startsWith.ts","../../src/compat/string/endsWith.ts","../../src/compat/math/max.ts","../../src/compat/math/min.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n","import { flatten } from '../../array/flatten.ts';\n\n/**\n * Concatenates multiple arrays and values into a single array.\n *\n * @template T The type of elements in the array.\n * @param {...(T | T[])} values - The values and/or arrays to concatenate.\n * @returns {T[]} A new array containing all the input values.\n *\n * @example\n * // Concatenate individual values\n * concat(1, 2, 3);\n * // returns [1, 2, 3]\n *\n * @example\n * // Concatenate arrays of values\n * concat([1, 2], [3, 4]);\n * // returns [1, 2, 3, 4]\n *\n * @example\n * // Concatenate a mix of individual values and arrays\n * concat(1, [2, 3], 4);\n * // returns [1, 2, 3, 4]\n *\n * @example\n * // Concatenate nested arrays\n * concat([1, [2, 3]], 4);\n * // returns [1, [2, 3], 4]\n */\nexport function concat<T>(...values: Array<T | readonly T[]>): T[] {\n return flatten(values) as T[];\n}\n","import { difference as differenceToolkit } from '../../array/difference.ts';\nimport { flatten } from '../../array/flatten.ts';\n\nexport function difference<T>(arr: readonly T[], ...values: Array<readonly T[]>): T[] {\n const arr1 = arr;\n const arr2 = flatten(values);\n\n return differenceToolkit(arr1, arr2);\n}","import { fill as fillToolkit } from '../../array/fill.ts';\n\n/**\n * Fills elements of an array with a specified value from the start position up to, but not including, the end position.\n *\n * This function mutates the original array and replaces its elements with the provided value, starting from the specified\n * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the\n * entire array.\n *\n * @template T, U, S, V\n * @param {Array<T | U>} array - The array to fill.\n * @param {U} value - The value to fill the array with.\n * @param {S} [start=0] - The start position. Defaults to 0.\n * @param {V} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | U>} The array with the filled values.\n *\n * @example\n * const array = [1, 2, 3];\n * const result = fill(array, 'a');\n * // => ['a', 'a', 'a']\n *\n * const result = fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * const result = fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n *\n * const result = fill(array, '*', -2, -1);\n * // => [1, '*', 3]\n */\nexport function fill<T>(array: unknown[], value?: T): T[];\nexport function fill<T, U, S>(array: Array<T | U>, value: U, start: S): Array<T | U>;\nexport function fill<T, U, S, V>(array: Array<T | U>, value: U, start: S, end: V): Array<T | U>;\nexport function fill<T, U>(array: Array<T | U>, value: U, start = 0, end = array.length): Array<T | U> {\n start = Math.floor(start);\n end = Math.floor(end);\n\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n\n return fillToolkit(array, value, start, end);\n}\n","const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/\n\nexport function isIndex(value: PropertyKey) {\n switch (typeof value) {\n case 'number': {\n return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;\n }\n case 'symbol': {\n return false;\n }\n case 'string': {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}","/**\n * Converts a deep key string into an array of path segments.\n *\n * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n *\n * @param {string} deepKey - The deep key string to convert.\n * @returns {string[]} An array of strings, each representing a segment of the path.\n *\n * Examples:\n *\n * toPath('a.b.c') // Returns ['a', 'b', 'c']\n * toPath('a[b][c]') // Returns ['a', 'b', 'c']\n * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n * toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n * toPath('') // Returns []\n * toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n */\nexport function toPath(deepKey: string): string[] {\n const ESCAPE_REGEXP = /\\\\(\\\\)?/g;\n const PROPERTY_REGEXP = RegExp(\n // Match anything that isn't a dot or bracket.\n '[^.[\\\\]]+' +\n '|' +\n // Or match property names within brackets.\n '\\\\[(?:' +\n // Match a non-string expression.\n '([^\"\\'][^[]*)' +\n '|' +\n // Or match strings (supports escaping characters).\n '([\"\\'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2' +\n ')\\\\]' +\n '|' +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n '(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))',\n 'g'\n );\n\n const result: string[] = [];\n\n if (deepKey[0] === '.') {\n result.push('');\n }\n\n let match: RegExpExecArray | null;\n let lastIndex = 0;\n\n while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {\n let key = match[0];\n const expr = match[1];\n const quote = match[2];\n const substr = match[3];\n\n if (quote) {\n key = substr.replace(ESCAPE_REGEXP, '$1');\n } else if (expr) {\n key = expr;\n }\n\n result.push(key);\n\n if (PROPERTY_REGEXP.lastIndex === lastIndex) {\n PROPERTY_REGEXP.lastIndex++;\n } else {\n lastIndex = PROPERTY_REGEXP.lastIndex;\n }\n }\n\n return result;\n}\n","import { isIndex } from \"../_internal/isIndex.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\n\n/**\n * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n *\n * @template T - The type of the object.\n * @param {Settable} obj - The object to modify.\n * @param {Path} path - The path of the property to set.\n * @param {any} value - The value to set.\n * @returns {T} - The modified object.\n *\n * @example\n * // Set a value in a nested object\n * const obj = { a: { b: { c: 3 } } };\n * set(obj, 'a.b.c', 4);\n * console.log(obj.a.b.c); // 4\n *\n * @example\n * // Set a value in an array\n * const arr = [1, 2, 3];\n * set(arr, 1, 4);\n * console.log(arr[1]); // 4\n *\n * @example\n * // Create non-existent path and set value\n * const obj = {};\n * set(obj, 'a.b.c', 4);\n * console.log(obj); // { a: { b: { c: 4 } } }\n */\nexport function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;\nexport function set<T extends object>(obj: T, path: PropertyKey | readonly PropertyKey[], value: unknown): T {\n const resolvedPath = Array.isArray(path)\n ? path\n : typeof path === 'string'\n ? toPath(path)\n : [path];\n\n let current: any = obj;\n\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] == null) {\n current[key] = isIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath[resolvedPath.length - 1];\n current[lastKey] = value;\n\n return obj;\n}\n","import { zip } from \"../../array/zip.ts\";\nimport { set } from \"../object/set.ts\";\n\n/**\n * Creates a deeply nested object given arrays of paths and values.\n *\n * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.\n * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.\n * Paths can be dot-separated strings or arrays of property names.\n * \n * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.\n *\n * @template V - The type of elements in the array.\n * @param {P[] | P[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.\n * @param {V[]} values - An array of values corresponding to the property paths.\n * @returns {object} A new object composed of the given property paths and values.\n *\n * @example\n * const paths = ['a.b.c', 'd.e.f'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n *\n * @example\n * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n * \n * @example\n * const paths = ['a.b[0].c', 'a.b[1].d'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\nexport function zipObjectDeep<P extends PropertyKey, V>(keys: P[] | P[][], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n const zipped = zip<P | P[], V>(keys, values);\n\n for (let i = 0; i < zipped.length; i++) {\n const [key, value] = zipped[i];\n\n if (key != null) {\n set(result, key, value);\n }\n }\n\n return result;\n}\n","const IS_PLAIN = /^\\w*$/;\nconst IS_DEEP = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\n\n/**\n * Checks if a given key is a deep key.\n *\n * A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n *\n * @param {PropertyKey} key - The key to check.\n * @returns {boolean} - Returns true if the key is a deep key, otherwise false.\n *\n * Examples:\n *\n * isDeepKey('a.b') // true\n * isDeepKey('a[b]') // true\n * isDeepKey('a') // false\n * isDeepKey(123) // false\n * isDeepKey('a.b.c') // true\n * isDeepKey('a[b][c]') // true\n */\nexport function isDeepKey(key: PropertyKey): boolean {\n switch (typeof key) {\n case 'number':\n case 'symbol': {\n return false;\n }\n case 'string': {\n return !IS_PLAIN.test(key) && IS_DEEP.test(key);\n }\n }\n}\n","import { isDeepKey } from \"../_internal/isDeepKey.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\nimport type { Get } from \"./get.types.ts\";\n\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n * \n * @param {T} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K]} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T>(object: T, path: K | [K]): T[K];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T>(object: T | null | undefined, path: K | [K]): T[K] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T, D>(object: T | null | undefined, path: K | [K], defaultValue: D): Exclude<T[K], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T, path: [K1, K2]): T[K1][K2];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T | null | undefined, path: [K1, K2]): T[K1][K2] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], D>(object: T | null | undefined, path: [K1, K2], defaultValue: D): Exclude<T[K1][K2], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T, path: [K1, K2, K3]): T[K1][K2][K3];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T | null | undefined, path: [K1, K2, K3]): T[K1][K2][K3] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], D>(object: T | null | undefined, path: [K1, K2, K3], defaultValue: D): Exclude<T[K1][K2][K3], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T, path: [K1, K2, K3, K4]): T[K1][K2][K3][K4];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T | null | undefined, path: [K1, K2, K3, K4]): T[K1][K2][K3][K4] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3][K4], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3], D>(object: T | null | undefined, path: [K1, K2, K3, K4], defaultValue: D): Exclude<T[K1][K2][K3][K4], undefined> | D;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * \n * @param {Record<number, T>} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T} - Returns the resolved value.\n */\nexport function get<T>(object: Record<number, T>, path: number): T;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * \n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T | undefined} - Returns the resolved value.\n */\nexport function get<T>(object: Record<number, T> | null | undefined, path: number): T | undefined;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * @template D - The type of the default value.\n * \n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {T | D} - Returns the resolved value.\n */\nexport function get<T, D>(object: Record<number, T> | null | undefined, path: number, defaultValue: D): T | D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning the default value.\n * \n * @template D - The type of the default value.\n * \n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {D} - Returns the default value.\n */\nexport function get<D>(object: null | undefined, path: PropertyKey, defaultValue: D): D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning undefined.\n * \n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @returns {undefined} - Returns undefined.\n */\nexport function get(object: null | undefined, path: PropertyKey): undefined;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template P - The type of the path.\n * \n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @returns {string extends P ? any : Get<T, P>} - Returns the resolved value.\n */\nexport function get<T, P extends string>(data: T, path: P): string extends P ? any : Get<T, P>;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template P - The type of the path.\n * @template D - The type of the default value.\n * \n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<Get<T, P>, null | undefined> | D} - Returns the resolved value.\n */\nexport function get<T, P extends string, D = Get<T, P>>(data: T, path: P, defaultValue: D): Exclude<Get<T, P>, null | undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @param {unknown} object - The object to query.\n * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get.\n * @param {unknown} [defaultValue] - The value returned if the resolved value is undefined.\n * @returns {any} - Returns the resolved value.\n */\nexport function get(object: unknown, path: PropertyKey | readonly PropertyKey[], defaultValue?: unknown): any;\nexport function get(object: any, path: PropertyKey | readonly PropertyKey[], defaultValue?: any): any {\n let resolvedPath;\n\n if (Array.isArray(path)) {\n resolvedPath = path;\n } else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {\n resolvedPath = toPath(path);\n } else {\n resolvedPath = [path];\n }\n\n if (resolvedPath.length === 0) {\n return defaultValue;\n }\n\n let current = object;\n let index;\n\n for (index = 0; index < resolvedPath.length && current != null; index++) {\n let key = resolvedPath[index];\n\n if (Object.is(key.valueOf(), -0)) {\n key = '-0';\n }\n\n current = current[key];\n }\n\n if (current === null && index === resolvedPath.length) {\n return current;\n }\n\n return current ?? defaultValue;\n}","import { get } from \"./get.ts\";\n\n/**\n * Creates a function that returns the value at a given path of an object.\n *\n * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get.\n * @returns {(object: unknown) => any} - Returns a new function that takes an object and returns the value at the specified path.\n *\n * @example\n * const getObjectValue = property('a.b.c');\n * const result = getObjectValue({ a: { b: { c: 3 } } });\n * console.log(result); // => 3\n * \n * @example\n * const getObjectValue = property(['a', 'b', 'c']);\n * const result = getObjectValue({ a: { b: { c: 3 } } });\n * console.log(result); // => 3\n */\nexport function property(path: PropertyKey | readonly PropertyKey[]): (object: unknown) => any {\n return function (object: unknown) {\n return get(object, path);\n }\n}","export function identity<T>(x: T) {\n return x;\n}","import { mapKeys as mapKeysToolkit } from '../../object/mapKeys.ts';\nimport { identity } from '../_internal/identity.ts';\nimport { property } from './property.ts';\n\n/**\n * Creates a new object with the same values as the given object, but with keys generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the keys in the object.\n *\n * @param {T} object - The object to iterate over.\n * @param {PropertyKey | PropertyKey[]} getNewKey - The path of the property to get to generate the new keys.\n * @returns {Record<K2, T[K1]>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapKeys(obj, (value, key) => key + value);\n * console.log(result); // { a1: 1, b2: 2 }\n */\nexport function mapKeys<T extends {}>(\n object: T,\n getNewKey?: PropertyKey | readonly PropertyKey[],\n): Record<PropertyKey, T[keyof T]>;\n\n/**\n * Creates a new object with the same values as the given object, but with keys generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the keys in the object.\n * @template K2 - The type of the new keys generated by the iteratee function.\n *\n * @param {T} object - The object to iterate over.\n * @param {(value: T[K1], key: K1, object: T) => K2} getNewKey - The function invoked per own enumerable property.\n * @returns {Record<K2, T[K1]>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapKeys(obj, (value, key) => key + value);\n * console.log(result); // { a1: 1, b2: 2 }\n */\nexport function mapKeys<T extends {}, K1 extends keyof T, K2 extends PropertyKey>(\n object: T,\n getNewKey?: (value: T[K1], key: K1, object: T) => K2\n): Record<K2, T[K1]>;\n\nexport function mapKeys<T extends {}, K1 extends keyof T, K2 extends PropertyKey>(\n object: T,\n getNewKey?: PropertyKey | readonly PropertyKey[] | ((value: T[K1], key: K1, object: T) => K2)\n): Record<K2, T[K1]> {\n getNewKey = getNewKey ?? identity as (value: T[K1], key: K1, object: T) => K2;\n\n switch (typeof getNewKey) {\n case 'string':\n case 'symbol':\n case 'number':\n case 'object': {\n return mapKeysToolkit(object, property(getNewKey));\n }\n case 'function': {\n return mapKeysToolkit(object, getNewKey);\n }\n }\n}\n","/**\n * Checks if a given value is a plain object.\n *\n * A plain object is an object created by the `{}` literal, `new Object()`, or\n * `Object.create(null)`.\n *\n * This function also handles objects with custom\n * `Symbol.toStringTag` properties.\n *\n * `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the\n * default string description of objects.\n *\n * @param {unknown} [object] - The value to check.\n * @returns {boolean} - True if the value is a plain object, otherwise false.\n *\n * @example\n * console.log(isPlainObject({})); // true\n * console.log(isPlainObject([])); // false\n * console.log(isPlainObject(null)); // false\n * console.log(isPlainObject(Object.create(null))); // true\n * console.log(isPlainObject(new Map())); // false\n */\nexport function isPlainObject(object?: unknown): boolean {\n if (typeof object !== 'object') {\n return false;\n }\n\n if (object == null) {\n return false;\n }\n\n if (Object.getPrototypeOf(object) === null) {\n return true;\n }\n\n if (object.toString() !== '[object Object]') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const tag = object[Symbol.toStringTag];\n\n if (tag == null) {\n return false;\n }\n\n const isTagReadonly = !Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable;\n\n if (isTagReadonly) {\n return false;\n }\n\n return object.toString() === `[object ${tag}]`;\n }\n\n let proto = object;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(object) === proto;\n}\n","/**\n * Checks if the given value is an array.\n *\n * This function tests whether the provided value is an array or not.\n * It returns `true` if the value is an array, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array.\n *\n * @template T - The type of value.\n * @param {T} value - The value to test if it is an array.\n * @returns {value is Extract<T, unknown[]>} `true` if the value is an array, `false` otherwise.\n *\n * @example\n * const value1 = [1, 2, 3];\n * const value2 = 'abc';\n * const value3 = () => {};\n *\n * console.log(isArray(value1)); // true\n * console.log(isArray(value2)); // false\n * console.log(isArray(value3)); // false\n */\nexport function isArray<T>(value?: T): value is Extract<T, readonly unknown[]> {\n return Array.isArray(value);\n}\n","import { isTypedArray as isTypedArrayToolkit } from '../../predicate/isTypedArray.ts';\n\n/**\n * Checks if a value is a TypedArray.\n * @param {unknown} x The value to check.\n * @returns {x is\n * | Uint8Array\n * | Uint8ClampedArray\n * | Uint16Array\n * | Uint32Array\n * | BigUint64Array\n * | Int8Array\n * | Int16Array\n * | Int32Array\n * | BigInt64Array\n * | Float32Array\n * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.\n */\nexport function isTypedArray(\n x?: unknown\n): x is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return isTypedArrayToolkit(x);\n}\n","import { isMatch } from '../predicate/isMatch.ts';\n\nexport function isArrayMatch(target: unknown, source: readonly unknown[]) {\n if (source.length === 0) {\n return true;\n }\n\n if (!Array.isArray(target)) {\n return false;\n }\n\n const countedIndex = new Set<number>();\n\n for (let i = 0; i < source.length; i++) {\n const sourceItem = source[i];\n const index = target.findIndex((targetItem, index) => {\n return isMatch(targetItem, sourceItem) && !countedIndex.has(index);\n });\n\n if (index === -1) {\n return false;\n }\n\n countedIndex.add(index);\n }\n\n return true;\n}\n","import { isMatch } from '../predicate/isMatch.ts';\n\nexport function isMapMatch(target: unknown, source: Map<any, any>) {\n if (source.size === 0) {\n return true;\n }\n\n if (!(target instanceof Map)) {\n return false;\n }\n\n for (const [key, value] of source.entries()) {\n if (!isMatch(target.get(key), value)) {\n return false;\n }\n }\n\n return true;\n}\n","import { isArrayMatch } from './isArrayMatch.ts';\n\nexport function isSetMatch(target: unknown, source: Set<any>) {\n if (source.size === 0) {\n return true;\n }\n\n if (!(target instanceof Set)) {\n return false;\n }\n\n return isArrayMatch([...target], [...source]);\n}\n","import { isPrimitive } from '../../predicate/isPrimitive.ts';\nimport { isArrayMatch } from '../_internal/isArrayMatch.ts';\nimport { isMapMatch } from '../_internal/isMapMatch.ts';\nimport { isSetMatch } from '../_internal/isSetMatch.ts';\n\n/**\n * Checks if the target matches the source by comparing their structures and values.\n * This function supports deep comparison for objects, arrays, maps, and sets.\n * \n * @param {unknown} target - The target value to match against.\n * @param {unknown} source - The source value to match with.\n * @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`.\n *\n * @example\n * // Basic usage\n * isMatch({ a: 1, b: 2 }, { a: 1 }); // true\n *\n * @example\n * // Matching arrays\n * isMatch([1, 2, 3], [1, 2, 3]); // true\n *\n * @example\n * // Matching maps\n * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]);\n * const sourceMap = new Map([['key1', 'value1']]);\n * isMatch(targetMap, sourceMap); // true\n *\n * @example\n * // Matching sets\n * const targetSet = new Set([1, 2, 3]);\n * const sourceSet = new Set([1, 2]);\n * isMatch(targetSet, sourceSet); // true\n */\nexport function isMatch(target: unknown, source: unknown): boolean;\nexport function isMatch(target: any, source: any): boolean {\n if (source === target) {\n return true;\n }\n\n switch (typeof source) {\n case 'object': {\n if (source == null) {\n return true;\n }\n\n source = source ?? {};\n\n const keys = Object.keys(source as any);\n\n if (target == null) {\n if (keys.length === 0) {\n return true;\n }\n\n return false;\n }\n\n if (Array.isArray(source)) {\n return isArrayMatch(target, source);\n }\n\n if (source instanceof Map) {\n return isMapMatch(target, source);\n }\n\n if (source instanceof Set) {\n return isSetMatch(target, source);\n }\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (!isPrimitive(target) && !(key in target)) {\n return false;\n }\n\n if (source[key] === undefined && target[key] !== undefined) {\n return false;\n }\n\n if (!isMatch(target[key], source[key])) {\n return false;\n }\n }\n\n return true;\n }\n case 'function': {\n if (Object.keys(source).length > 0) {\n return isMatch(target, { ...source });\n }\n\n return false;\n }\n default: {\n return !source;\n }\n }\n}\n","import { cloneDeep } from '../../object/cloneDeep.ts';\nimport { isMatch } from './isMatch.ts';\n\n/**\n * Creates a function that performs a deep comparison between a given target and the source object.\n * \n * @param {unknown} source - The source object to create the matcher from.\n * @returns {(target: unknown) => boolean} - Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`.\n *\n * @example\n * // Basic usage\n * const matcher = matches({ a: 1, b: 2 });\n * matcher({ a: 1, b: 2, c: 3 }); // true\n * matcher({ a: 1, c: 3 }); // false\n *\n * @example\n * // Matching arrays\n * const arrayMatcher = matches([1, 2, 3]);\n * arrayMatcher([1, 2, 3, 4]); // true\n * arrayMatcher([4, 5, 6]); // false\n *\n * @example\n * // Matching objects with nested structures\n * const nestedMatcher = matches({ a: { b: 2 } });\n * nestedMatcher({ a: { b: 2, c: 3 } }); // true\n * nestedMatcher({ a: { c: 3 } }); // false\n */\nexport function matches(source: unknown): (target: unknown) => boolean {\n source = cloneDeep(source);\n\n return (target?: unknown): boolean => {\n return isMatch(target, source);\n };\n}\n","/**\n * Checks if a string contains another string at the beginning of the string.\n *\n * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional offset to start searching in the str string\n * @returns {boolean} - True if the str string starts with the target string.\n *\n * @example\n * const isPrefix = startsWith('fooBar', 'foo') // returns true\n * const isPrefix = startsWith('fooBar', 'bar') // returns false\n * const isPrefix = startsWith('fooBar', 'abc') // returns false\n * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true\n * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false\n */\nexport const startsWith = (str: string, target: string, position = 0): boolean => {\n return str.startsWith(target, position);\n};\n","/**\n * Checks if a string contains another string at the end of the string.\n *\n * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional position from the start to search up to this index\n * @returns {boolean} - True if the str string ends with the target string.\n *\n * @example\n * const isPrefix = endsWith('fooBar', 'foo') // returns true\n * const isPrefix = endsWith('fooBar', 'bar') // returns false\n * const isPrefix = endsWith('fooBar', 'abc') // returns false\n * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true\n * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false\n */\nexport const endsWith = (str: string, target: string, position: number = str.length): boolean => {\n return str.endsWith(target, position);\n};\n","/**\n * Finds the element in an array that has the maximum value.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @returns {T | undefined} The element with the maximum value.\n * @example\n * // Returns 9\n * max([3, 1, 4, 1, 5, 9])\n *\n * @example\n * // Returns 8\n * max([0, -3, 2, 8, 7])\n */\nexport function max<T>(items: readonly [T, ...T[]]): T;\nexport function max(): undefined;\nexport function max<T>(items?: readonly T[]): T | undefined;\nexport function max<T>(items: readonly T[] = []): T | undefined {\n let maxElement = items[0];\n let max = undefined;\n\n for (const element of items) {\n if (max == null || element > max) {\n max = element;\n maxElement = element;\n }\n }\n\n return maxElement;\n}\n","/**\n * Finds the element in an array that has the minimum value.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @returns {T | undefined} The element with the minimum value.\n * @example\n * // Returns 1\n * min([3, 1, 4, 1, 5, 9])\n *\n * @example\n * // Returns -3\n * min([0, -3, 2, 8, 7])\n */\nexport function min<T>(items: readonly [T, ...T[]]): T;\nexport function min(): undefined;\nexport function min<T>(items?: readonly T[]): T | undefined;\nexport function min<T>(items: readonly T[] = []): T {\n let minElement = items[0];\n let min = undefined;\n\n for (const element of items) {\n if (min == null || element < min) {\n min = element;\n minElement = element;\n }\n }\n\n return minElement;\n}\n"],"names":["chunkToolkit","flatten","differenceToolkit","fillToolkit","zip","mapKeysToolkit","isTypedArrayToolkit","isPrimitive","cloneDeep"],"mappings":";;;;;;;;;;;;;;SAyBgB,KAAK,CAAI,GAAiB,EAAE,IAAI,GAAG,CAAC,EAAA;AAClD,IAAA,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAErC,IAAA,IAAI,IAAI,KAAK,CAAC,EAAE;AACd,QAAA,OAAO,EAAE,CAAC;KACX;AAED,IAAA,OAAOA,iBAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACjC;;ACJgB,SAAA,MAAM,CAAI,GAAG,MAA+B,EAAA;AAC1D,IAAA,OAAOC,mBAAO,CAAC,MAAM,CAAQ,CAAC;AAChC;;SC5BgB,UAAU,CAAI,GAAiB,EAAE,GAAG,MAA2B,EAAA;IAC7E,MAAM,IAAI,GAAG,GAAG,CAAC;AACjB,IAAA,MAAM,IAAI,GAAGA,mBAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,IAAA,OAAOC,sBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC;;ACyBgB,SAAA,IAAI,CAAO,KAAmB,EAAE,KAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAA;AACrF,IAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1B,IAAA,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtB,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,CAAC,CAAC;KACX;IACD,IAAI,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QAC3B,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,GAAG,EAAE;YAChC,GAAG,GAAG,OAAO,CAAC;YACd,UAAU,GAAG,OAAO,CAAC;SACtB;KACF;AAED,IAAA,OAAO,UAAU,CAAC;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"max.mjs","sources":["../../../src/compat/math/max.ts"],"sourcesContent":["/**\n * Finds the element in an array that has the maximum value.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @returns {T | undefined} The element with the maximum value.\n * @example\n * // Returns 9\n * max([3, 1, 4, 1, 5, 9])\n *\n * @example\n * // Returns 8\n * max([0, -3, 2, 8, 7])\n */\nexport function max<T>(items: readonly [T, ...T[]]): T;\nexport function max(): undefined;\nexport function max<T>(items?: readonly T[]): T | undefined;\nexport function max<T>(items: readonly T[] = []): T | undefined {\n let maxElement = items[0];\n let max = undefined;\n\n for (const element of items) {\n if (max == null || element > max) {\n max = element;\n maxElement = element;\n }\n }\n\n return maxElement;\n}\n"],"names":[],"mappings":"AAiBgB,SAAA,GAAG,CAAI,KAAA,GAAsB,EAAE,EAAA;AAC7C,IAAA,IAAI,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,GAAG,GAAG,SAAS,CAAC;AAEpB,IAAA,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE;QAC3B,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,GAAG,EAAE;YAChC,GAAG,GAAG,OAAO,CAAC;YACd,UAAU,GAAG,OAAO,CAAC;SACtB;KACF;AAED,IAAA,OAAO,UAAU,CAAC;AACpB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"min.mjs","sources":["../../../src/compat/math/min.ts"],"sourcesContent":["/**\n * Finds the element in an array that has the minimum value.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @returns {T | undefined} The element with the minimum value.\n * @example\n * // Returns 1\n * min([3, 1, 4, 1, 5, 9])\n *\n * @example\n * // Returns -3\n * min([0, -3, 2, 8, 7])\n */\nexport function min<T>(items: readonly [T, ...T[]]): T;\nexport function min(): undefined;\nexport function min<T>(items?: readonly T[]): T | undefined;\nexport function min<T>(items: readonly T[] = []): T {\n let minElement = items[0];\n let min = undefined;\n\n for (const element of items) {\n if (min == null || element < min) {\n min = element;\n minElement = element;\n }\n }\n\n return minElement;\n}\n"],"names":[],"mappings":"AAiBgB,SAAA,GAAG,CAAI,KAAA,GAAsB,EAAE,EAAA;AAC7C,IAAA,IAAI,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,GAAG,GAAG,SAAS,CAAC;AAEpB,IAAA,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE;QAC3B,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,GAAG,EAAE;YAChC,GAAG,GAAG,OAAO,CAAC;YACd,UAAU,GAAG,OAAO,CAAC;SACtB;KACF;AAED,IAAA,OAAO,UAAU,CAAC;AACpB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get.mjs","sources":["../../../src/compat/object/get.ts"],"sourcesContent":["import { isDeepKey } from \"../_internal/isDeepKey.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\nimport type { Get } from \"./get.types.ts\";\n\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n * \n * @param {T} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K]} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T>(object: T, path: K | [K]): T[K];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @returns {T[K] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T>(object: T | null | undefined, path: K | [K]): T[K] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K - The type of the key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {K | [K]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K extends keyof T, D>(object: T | null | undefined, path: K | [K], defaultValue: D): Exclude<T[K], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T, path: [K1, K2]): T[K1][K2];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @returns {T[K1][K2] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(object: T | null | undefined, path: [K1, K2]): T[K1][K2] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], D>(object: T | null | undefined, path: [K1, K2], defaultValue: D): Exclude<T[K1][K2], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T, path: [K1, K2, K3]): T[K1][K2][K3];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @returns {T[K1][K2][K3] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(object: T | null | undefined, path: [K1, K2, K3]): T[K1][K2][K3] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], D>(object: T | null | undefined, path: [K1, K2, K3], defaultValue: D): Exclude<T[K1][K2][K3], undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * \n * @param {T} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4]} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T, path: [K1, K2, K3, K4]): T[K1][K2][K3][K4];\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @returns {T[K1][K2][K3][K4] | undefined} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(object: T | null | undefined, path: [K1, K2, K3, K4]): T[K1][K2][K3][K4] | undefined;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template K1 - The type of the first key in the object.\n * @template K2 - The type of the second key in the object.\n * @template K3 - The type of the third key in the object.\n * @template K4 - The type of the fourth key in the object.\n * @template D - The type of the default value.\n * \n * @param {T | null | undefined} object - The object to query.\n * @param {[K1, K2, K3, K4]} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<T[K1][K2][K3][K4], undefined> | D} - Returns the resolved value.\n */\nexport function get<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3], D>(object: T | null | undefined, path: [K1, K2, K3, K4], defaultValue: D): Exclude<T[K1][K2][K3][K4], undefined> | D;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * \n * @param {Record<number, T>} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T} - Returns the resolved value.\n */\nexport function get<T>(object: Record<number, T>, path: number): T;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * \n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @returns {T | undefined} - Returns the resolved value.\n */\nexport function get<T>(object: Record<number, T> | null | undefined, path: number): T | undefined;\n/**\n * Retrieves the value at a given path from an object with numeric keys. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the value.\n * @template D - The type of the default value.\n * \n * @param {Record<number, T> | null | undefined} object - The object to query.\n * @param {number} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {T | D} - Returns the resolved value.\n */\nexport function get<T, D>(object: Record<number, T> | null | undefined, path: number, defaultValue: D): T | D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning the default value.\n * \n * @template D - The type of the default value.\n * \n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {D} - Returns the default value.\n */\nexport function get<D>(object: null | undefined, path: PropertyKey, defaultValue: D): D;\n/**\n * Retrieves the value at a given path from a null or undefined object, returning undefined.\n * \n * @param {null | undefined} object - The object to query.\n * @param {PropertyKey} path - The path of the property to get.\n * @returns {undefined} - Returns undefined.\n */\nexport function get(object: null | undefined, path: PropertyKey): undefined;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template P - The type of the path.\n * \n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @returns {string extends P ? any : Get<T, P>} - Returns the resolved value.\n */\nexport function get<T, P extends string>(data: T, path: P): string extends P ? any : Get<T, P>;\n/**\n * Retrieves the value at a given path from a string-keyed object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @template T - The type of the object.\n * @template P - The type of the path.\n * @template D - The type of the default value.\n * \n * @param {T} data - The object to query.\n * @param {P} path - The path of the property to get.\n * @param {D} defaultValue - The value returned if the resolved value is undefined.\n * @returns {Exclude<Get<T, P>, null | undefined> | D} - Returns the resolved value.\n */\nexport function get<T, P extends string, D = Get<T, P>>(data: T, path: P, defaultValue: D): Exclude<Get<T, P>, null | undefined> | D;\n/**\n * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n * \n * @param {unknown} object - The object to query.\n * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get.\n * @param {unknown} [defaultValue] - The value returned if the resolved value is undefined.\n * @returns {any} - Returns the resolved value.\n */\nexport function get(object: unknown, path: PropertyKey | readonly PropertyKey[], defaultValue?: unknown): any;\nexport function get(object: any, path: PropertyKey | readonly PropertyKey[], defaultValue?: any): any {\n let resolvedPath;\n\n if (Array.isArray(path)) {\n resolvedPath = path;\n } else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {\n resolvedPath = toPath(path);\n } else {\n resolvedPath = [path];\n }\n\n if (resolvedPath.length === 0) {\n return defaultValue;\n }\n\n let current = object;\n let index;\n\n for (index = 0; index < resolvedPath.length && current != null; index++) {\n let key = resolvedPath[index];\n\n if (Object.is(key.valueOf(), -0)) {\n key = '-0';\n }\n\n current = current[key];\n }\n\n if (current === null && index === resolvedPath.length) {\n return current;\n }\n\n return current ?? defaultValue;\n}"],"names":[],"mappings":";;;SAuPgB,GAAG,CAAC,MAAW,EAAE,IAA0C,EAAE,YAAkB,EAAA;AAC7F,IAAA,IAAI,YAAY,CAAC;AAEjB,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvB,YAAY,GAAG,IAAI,CAAC;KACrB;AAAM,SAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE;AAChF,QAAA,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;KAC7B;SAAM;AACL,QAAA,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC;KACvB;AAED,IAAA,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;AAC7B,QAAA,OAAO,YAAY,CAAC;KACrB;IAED,IAAI,OAAO,GAAG,MAAM,CAAC;AACrB,IAAA,IAAI,KAAK,CAAC;AAEV,IAAA,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,MAAM,IAAI,OAAO,IAAI,IAAI,EAAE,KAAK,EAAE,EAAE;AACvE,QAAA,IAAI,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AAE9B,QAAA,IAAI,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;YAChC,GAAG,GAAG,IAAI,CAAC;SACZ;AAED,QAAA,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;KACxB;IAED,IAAI,OAAO,KAAK,IAAI,IAAI,KAAK,KAAK,YAAY,CAAC,MAAM,EAAE;AACrD,QAAA,OAAO,OAAO,CAAC;KAChB;IAED,OAAO,OAAO,IAAI,YAAY,CAAC;AACjC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapKeys.mjs","sources":["../../../src/compat/object/mapKeys.ts"],"sourcesContent":["import { mapKeys as mapKeysToolkit } from '../../object/mapKeys.ts';\nimport { identity } from '../_internal/identity.ts';\nimport { property } from './property.ts';\n\n/**\n * Creates a new object with the same values as the given object, but with keys generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the keys in the object.\n *\n * @param {T} object - The object to iterate over.\n * @param {PropertyKey | PropertyKey[]} getNewKey - The path of the property to get to generate the new keys.\n * @returns {Record<K2, T[K1]>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapKeys(obj, (value, key) => key + value);\n * console.log(result); // { a1: 1, b2: 2 }\n */\nexport function mapKeys<T extends {}>(\n object: T,\n getNewKey?: PropertyKey | readonly PropertyKey[],\n): Record<PropertyKey, T[keyof T]>;\n\n/**\n * Creates a new object with the same values as the given object, but with keys generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the keys in the object.\n * @template K2 - The type of the new keys generated by the iteratee function.\n *\n * @param {T} object - The object to iterate over.\n * @param {(value: T[K1], key: K1, object: T) => K2} getNewKey - The function invoked per own enumerable property.\n * @returns {Record<K2, T[K1]>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapKeys(obj, (value, key) => key + value);\n * console.log(result); // { a1: 1, b2: 2 }\n */\nexport function mapKeys<T extends {}, K1 extends keyof T, K2 extends PropertyKey>(\n object: T,\n getNewKey?: (value: T[K1], key: K1, object: T) => K2\n): Record<K2, T[K1]>;\n\nexport function mapKeys<T extends {}, K1 extends keyof T, K2 extends PropertyKey>(\n object: T,\n getNewKey?: PropertyKey | readonly PropertyKey[] | ((value: T[K1], key: K1, object: T) => K2)\n): Record<K2, T[K1]> {\n getNewKey = getNewKey ?? identity as (value: T[K1], key: K1, object: T) => K2;\n\n switch (typeof getNewKey) {\n case 'string':\n case 'symbol':\n case 'number':\n case 'object': {\n return mapKeysToolkit(object, property(getNewKey));\n }\n case 'function': {\n return mapKeysToolkit(object, getNewKey);\n }\n }\n}\n"],"names":["mapKeysToolkit"],"mappings":";;;;AAiDgB,SAAA,OAAO,CACrB,MAAS,EACT,SAA6F,EAAA;AAE7F,IAAA,SAAS,GAAG,SAAS,IAAI,QAAoD,CAAC;IAE9E,QAAQ,OAAO,SAAS;AACtB,QAAA,KAAK,QAAQ,CAAC;AACd,QAAA,KAAK,QAAQ,CAAC;AACd,QAAA,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,EAAE;YACb,OAAOA,SAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;SACpD;QACD,KAAK,UAAU,EAAE;AACf,YAAA,OAAOA,SAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;SAC1C;KACF;AACH;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"property.mjs","sources":["../../../src/compat/object/property.ts"],"sourcesContent":["import { get } from \"./get.ts\";\n\n/**\n * Creates a function that returns the value at a given path of an object.\n *\n * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get.\n * @returns {(object: unknown) => any} - Returns a new function that takes an object and returns the value at the specified path.\n *\n * @example\n * const getObjectValue = property('a.b.c');\n * const result = getObjectValue({ a: { b: { c: 3 } } });\n * console.log(result); // => 3\n * \n * @example\n * const getObjectValue = property(['a', 'b', 'c']);\n * const result = getObjectValue({ a: { b: { c: 3 } } });\n * console.log(result); // => 3\n */\nexport function property(path: PropertyKey | readonly PropertyKey[]): (object: unknown) => any {\n return function (object: unknown) {\n return get(object, path);\n }\n}"],"names":[],"mappings":";;AAkBM,SAAU,QAAQ,CAAC,IAA0C,EAAA;AACjE,IAAA,OAAO,UAAU,MAAe,EAAA;AAC9B,QAAA,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC3B,KAAC,CAAA;AACH;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set.mjs","sources":["../../../src/compat/object/set.ts"],"sourcesContent":["import { isIndex } from \"../_internal/isIndex.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\n\n/**\n * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n *\n * @template T - The type of the object.\n * @param {Settable} obj - The object to modify.\n * @param {Path} path - The path of the property to set.\n * @param {any} value - The value to set.\n * @returns {T} - The modified object.\n *\n * @example\n * // Set a value in a nested object\n * const obj = { a: { b: { c: 3 } } };\n * set(obj, 'a.b.c', 4);\n * console.log(obj.a.b.c); // 4\n *\n * @example\n * // Set a value in an array\n * const arr = [1, 2, 3];\n * set(arr, 1, 4);\n * console.log(arr[1]); // 4\n *\n * @example\n * // Create non-existent path and set value\n * const obj = {};\n * set(obj, 'a.b.c', 4);\n * console.log(obj); // { a: { b: { c: 4 } } }\n */\nexport function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;\nexport function set<T extends object>(obj: T, path: PropertyKey | readonly PropertyKey[], value: unknown): T {\n const resolvedPath = Array.isArray(path)\n ? path\n : typeof path === 'string'\n ? toPath(path)\n : [path];\n\n let current: any = obj;\n\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] == null) {\n current[key] = isIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath[resolvedPath.length - 1];\n current[lastKey] = value;\n\n return obj;\n}\n"],"names":[],"mappings":";;;SA+BgB,GAAG,CAAmB,GAAM,EAAE,IAA0C,EAAE,KAAc,EAAA;AACtG,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AACtC,UAAE,IAAI;AACN,UAAE,OAAO,IAAI,KAAK,QAAQ;AACxB,cAAE,MAAM,CAAC,IAAI,CAAC;AACd,cAAE,CAAC,IAAI,CAAC,CAAC;IAEb,IAAI,OAAO,GAAQ,GAAG,CAAC;AAEvB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAChD,QAAA,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpC,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;AACxB,YAAA,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;SAC3C;AAED,QAAA,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;KACxB;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACtD,IAAA,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;AAEzB,IAAA,OAAO,GAAG,CAAC;AACb;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isArray.mjs","sources":["../../../src/compat/predicate/isArray.ts"],"sourcesContent":["/**\n * Checks if the given value is an array.\n *\n * This function tests whether the provided value is an array or not.\n * It returns `true` if the value is an array, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array.\n *\n * @template T - The type of value.\n * @param {T} value - The value to test if it is an array.\n * @returns {value is Extract<T, unknown[]>} `true` if the value is an array, `false` otherwise.\n *\n * @example\n * const value1 = [1, 2, 3];\n * const value2 = 'abc';\n * const value3 = () => {};\n *\n * console.log(isArray(value1)); // true\n * console.log(isArray(value2)); // false\n * console.log(isArray(value3)); // false\n */\nexport function isArray<T>(value?: T): value is Extract<T, readonly unknown[]> {\n return Array.isArray(value);\n}\n"],"names":[],"mappings":"AAqBM,SAAU,OAAO,CAAI,KAAS,EAAA;AAClC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isMatch.mjs","sources":["../../../src/compat/predicate/isMatch.ts"],"sourcesContent":["import { isPrimitive } from '../../predicate/isPrimitive.ts';\nimport { isArrayMatch } from '../_internal/isArrayMatch.ts';\nimport { isMapMatch } from '../_internal/isMapMatch.ts';\nimport { isSetMatch } from '../_internal/isSetMatch.ts';\n\n/**\n * Checks if the target matches the source by comparing their structures and values.\n * This function supports deep comparison for objects, arrays, maps, and sets.\n * \n * @param {unknown} target - The target value to match against.\n * @param {unknown} source - The source value to match with.\n * @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`.\n *\n * @example\n * // Basic usage\n * isMatch({ a: 1, b: 2 }, { a: 1 }); // true\n *\n * @example\n * // Matching arrays\n * isMatch([1, 2, 3], [1, 2, 3]); // true\n *\n * @example\n * // Matching maps\n * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]);\n * const sourceMap = new Map([['key1', 'value1']]);\n * isMatch(targetMap, sourceMap); // true\n *\n * @example\n * // Matching sets\n * const targetSet = new Set([1, 2, 3]);\n * const sourceSet = new Set([1, 2]);\n * isMatch(targetSet, sourceSet); // true\n */\nexport function isMatch(target: unknown, source: unknown): boolean;\nexport function isMatch(target: any, source: any): boolean {\n if (source === target) {\n return true;\n }\n\n switch (typeof source) {\n case 'object': {\n if (source == null) {\n return true;\n }\n\n source = source ?? {};\n\n const keys = Object.keys(source as any);\n\n if (target == null) {\n if (keys.length === 0) {\n return true;\n }\n\n return false;\n }\n\n if (Array.isArray(source)) {\n return isArrayMatch(target, source);\n }\n\n if (source instanceof Map) {\n return isMapMatch(target, source);\n }\n\n if (source instanceof Set) {\n return isSetMatch(target, source);\n }\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (!isPrimitive(target) && !(key in target)) {\n return false;\n }\n\n if (source[key] === undefined && target[key] !== undefined) {\n return false;\n }\n\n if (!isMatch(target[key], source[key])) {\n return false;\n }\n }\n\n return true;\n }\n case 'function': {\n if (Object.keys(source).length > 0) {\n return isMatch(target, { ...source });\n }\n\n return false;\n }\n default: {\n return !source;\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAkCgB,SAAA,OAAO,CAAC,MAAW,EAAE,MAAW,EAAA;AAC9C,IAAA,IAAI,MAAM,KAAK,MAAM,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;KACb;IAED,QAAQ,OAAO,MAAM;QACnB,KAAK,QAAQ,EAAE;AACb,YAAA,IAAI,MAAM,IAAI,IAAI,EAAE;AAClB,gBAAA,OAAO,IAAI,CAAC;aACb;AAED,YAAA,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;YAEtB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAa,CAAC,CAAC;AAExC,YAAA,IAAI,MAAM,IAAI,IAAI,EAAE;AAClB,gBAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,oBAAA,OAAO,IAAI,CAAC;iBACb;AAED,gBAAA,OAAO,KAAK,CAAC;aACd;AAED,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACzB,gBAAA,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aACrC;AAED,YAAA,IAAI,MAAM,YAAY,GAAG,EAAE;AACzB,gBAAA,OAAO,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aACnC;AAED,YAAA,IAAI,MAAM,YAAY,GAAG,EAAE;AACzB,gBAAA,OAAO,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aACnC;AAED,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,gBAAA,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpB,gBAAA,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,EAAE;AAC5C,oBAAA,OAAO,KAAK,CAAC;iBACd;AAED,gBAAA,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;AAC1D,oBAAA,OAAO,KAAK,CAAC;iBACd;AAED,gBAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;AACtC,oBAAA,OAAO,KAAK,CAAC;iBACd;aACF;AAED,YAAA,OAAO,IAAI,CAAC;SACb;QACD,KAAK,UAAU,EAAE;YACf,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBAClC,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;aACvC;AAED,YAAA,OAAO,KAAK,CAAC;SACd;QACD,SAAS;YACP,OAAO,CAAC,MAAM,CAAC;SAChB;KACF;AACH;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isPlainObject.mjs","sources":["../../../src/compat/predicate/isPlainObject.ts"],"sourcesContent":["/**\n * Checks if a given value is a plain object.\n *\n * A plain object is an object created by the `{}` literal, `new Object()`, or\n * `Object.create(null)`.\n *\n * This function also handles objects with custom\n * `Symbol.toStringTag` properties.\n *\n * `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the\n * default string description of objects.\n *\n * @param {unknown} [object] - The value to check.\n * @returns {boolean} - True if the value is a plain object, otherwise false.\n *\n * @example\n * console.log(isPlainObject({})); // true\n * console.log(isPlainObject([])); // false\n * console.log(isPlainObject(null)); // false\n * console.log(isPlainObject(Object.create(null))); // true\n * console.log(isPlainObject(new Map())); // false\n */\nexport function isPlainObject(object?: unknown): boolean {\n if (typeof object !== 'object') {\n return false;\n }\n\n if (object == null) {\n return false;\n }\n\n if (Object.getPrototypeOf(object) === null) {\n return true;\n }\n\n if (object.toString() !== '[object Object]') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const tag = object[Symbol.toStringTag];\n\n if (tag == null) {\n return false;\n }\n\n const isTagReadonly = !Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable;\n\n if (isTagReadonly) {\n return false;\n }\n\n return object.toString() === `[object ${tag}]`;\n }\n\n let proto = object;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(object) === proto;\n}\n"],"names":[],"mappings":"AAsBM,SAAU,aAAa,CAAC,MAAgB,EAAA;AAC5C,IAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,QAAA,OAAO,KAAK,CAAC;KACd;AAED,IAAA,IAAI,MAAM,IAAI,IAAI,EAAE;AAClB,QAAA,OAAO,KAAK,CAAC;KACd;IAED,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;AAC1C,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,iBAAiB,EAAE;QAG3C,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvC,QAAA,IAAI,GAAG,IAAI,IAAI,EAAE;AACf,YAAA,OAAO,KAAK,CAAC;SACd;AAED,QAAA,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;QAE7F,IAAI,aAAa,EAAE;AACjB,YAAA,OAAO,KAAK,CAAC;SACd;QAED,OAAO,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAW,QAAA,EAAA,GAAG,GAAG,CAAC;KAChD;IAED,IAAI,KAAK,GAAG,MAAM,CAAC;IAEnB,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;AAC5C,QAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;KACtC;IAED,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC;AACjD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isTypedArray.mjs","sources":["../../../src/compat/predicate/isTypedArray.ts"],"sourcesContent":["import { isTypedArray as isTypedArrayToolkit } from '../../predicate/isTypedArray.ts';\n\n/**\n * Checks if a value is a TypedArray.\n * @param {unknown} x The value to check.\n * @returns {x is\n * | Uint8Array\n * | Uint8ClampedArray\n * | Uint16Array\n * | Uint32Array\n * | BigUint64Array\n * | Int8Array\n * | Int16Array\n * | Int32Array\n * | BigInt64Array\n * | Float32Array\n * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.\n */\nexport function isTypedArray(\n x?: unknown\n): x is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return isTypedArrayToolkit(x);\n}\n"],"names":["isTypedArrayToolkit"],"mappings":";;AAkBM,SAAU,YAAY,CAC1B,CAAW,EAAA;AAaX,IAAA,OAAOA,cAAmB,CAAC,CAAC,CAAC,CAAC;AAChC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matches.mjs","sources":["../../../src/compat/predicate/matches.ts"],"sourcesContent":["import { cloneDeep } from '../../object/cloneDeep.ts';\nimport { isMatch } from './isMatch.ts';\n\n/**\n * Creates a function that performs a deep comparison between a given target and the source object.\n * \n * @param {unknown} source - The source object to create the matcher from.\n * @returns {(target: unknown) => boolean} - Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`.\n *\n * @example\n * // Basic usage\n * const matcher = matches({ a: 1, b: 2 });\n * matcher({ a: 1, b: 2, c: 3 }); // true\n * matcher({ a: 1, c: 3 }); // false\n *\n * @example\n * // Matching arrays\n * const arrayMatcher = matches([1, 2, 3]);\n * arrayMatcher([1, 2, 3, 4]); // true\n * arrayMatcher([4, 5, 6]); // false\n *\n * @example\n * // Matching objects with nested structures\n * const nestedMatcher = matches({ a: { b: 2 } });\n * nestedMatcher({ a: { b: 2, c: 3 } }); // true\n * nestedMatcher({ a: { c: 3 } }); // false\n */\nexport function matches(source: unknown): (target: unknown) => boolean {\n source = cloneDeep(source);\n\n return (target?: unknown): boolean => {\n return isMatch(target, source);\n };\n}\n"],"names":[],"mappings":";;;AA2BM,SAAU,OAAO,CAAC,MAAe,EAAA;AACrC,IAAA,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAE3B,OAAO,CAAC,MAAgB,KAAa;AACnC,QAAA,OAAO,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjC,KAAC,CAAC;AACJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endsWith.mjs","sources":["../../../src/compat/string/endsWith.ts"],"sourcesContent":["/**\n * Checks if a string contains another string at the end of the string.\n *\n * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional position from the start to search up to this index\n * @returns {boolean} - True if the str string ends with the target string.\n *\n * @example\n * const isPrefix = endsWith('fooBar', 'foo') // returns true\n * const isPrefix = endsWith('fooBar', 'bar') // returns false\n * const isPrefix = endsWith('fooBar', 'abc') // returns false\n * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true\n * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false\n */\nexport const endsWith = (str: string, target: string, position: number = str.length): boolean => {\n return str.endsWith(target, position);\n};\n"],"names":[],"mappings":"AAiBO,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,QAAmB,GAAA,GAAG,CAAC,MAAM,KAAa;IAC9F,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACxC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startsWith.mjs","sources":["../../../src/compat/string/startsWith.ts"],"sourcesContent":["/**\n * Checks if a string contains another string at the beginning of the string.\n *\n * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional offset to start searching in the str string\n * @returns {boolean} - True if the str string starts with the target string.\n *\n * @example\n * const isPrefix = startsWith('fooBar', 'foo') // returns true\n * const isPrefix = startsWith('fooBar', 'bar') // returns false\n * const isPrefix = startsWith('fooBar', 'abc') // returns false\n * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true\n * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false\n */\nexport const startsWith = (str: string, target: string, position = 0): boolean => {\n return str.startsWith(target, position);\n};\n"],"names":[],"mappings":"AAiBO,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,QAAQ,GAAG,CAAC,KAAa;IAC/E,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC1C;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbortError.mjs","sources":["../../src/error/AbortError.ts"],"sourcesContent":["/**\n * An error class representing an aborted operation.\n * @augments Error\n */\nexport class AbortError extends Error {\n constructor(message = 'The operation was aborted') {\n super(message);\n this.name = 'AbortError';\n }\n}\n"],"names":[],"mappings":"AAIM,MAAO,UAAW,SAAQ,KAAK,CAAA;IACnC,WAAY,CAAA,OAAO,GAAG,2BAA2B,EAAA;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;KAC1B;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TimeoutError.mjs","sources":["../../src/error/TimeoutError.ts"],"sourcesContent":["/**\n * An error class representing an timeout operation.\n * @augments Error\n */\nexport class TimeoutError extends Error {\n constructor(message = 'The operation was timed out') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n"],"names":[],"mappings":"AAIM,MAAO,YAAa,SAAQ,KAAK,CAAA;IACrC,WAAY,CAAA,OAAO,GAAG,6BAA6B,EAAA;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;AACf,QAAA,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;KAC5B;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"after.mjs","sources":["../../src/function/after.ts"],"sourcesContent":["/**\n * Creates a function that only executes starting from the `n`-th call.\n * The provided function will be invoked starting from the `n`-th call.\n *\n * This is particularly useful for scenarios involving events or asynchronous operations\n * where an action should occur only after a certain number of invocations.\n *\n * @template F - The type of the function to be invoked.\n * @param {number} n - The number of calls required for `func` to execute.\n * @param {F} func - The function to be invoked.\n * @returns {F} - A new function that:\n * - Tracks the number of calls.\n * - Invokes `func` starting from the `n`-th call.\n * - Returns `undefined` if fewer than `n` calls have been made.\n * @throws {Error} - Throws an error if `n` is negative.\n * @example\n *\n * const afterFn = after(3, () => {\n * console.log(\"called\")\n * });\n *\n * // Will not log anything.\n * afterFn()\n * // Will not log anything.\n * afterFn()\n * // Will log 'called'.\n * afterFn()\n */\n\nexport const after = <F extends (...args: any[]) => any>(n: number, func: F): F => {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error(`n must be a non-negative integer.`);\n }\n\n let counter = 0;\n return ((...args: Parameters<F>) => {\n if (++counter >= n) {\n return func(...args);\n }\n return undefined;\n }) as F;\n};\n"],"names":[],"mappings":"MA6Ba,KAAK,GAAG,CAAoC,CAAS,EAAE,IAAO,KAAO;AAChF,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,iCAAA,CAAmC,CAAC,CAAC;KACtD;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;AAChB,IAAA,QAAQ,CAAC,GAAG,IAAmB,KAAI;AACjC,QAAA,IAAI,EAAE,OAAO,IAAI,CAAC,EAAE;AAClB,YAAA,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACtB;AACD,QAAA,OAAO,SAAS,CAAC;AACnB,KAAC,EAAO;AACV;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"before.mjs","sources":["../../src/function/before.ts"],"sourcesContent":["/**\n * Creates a function that limits the number of times the given function (`func`) can be called.\n *\n * @template F - The type of the function to be invoked.\n * @param {number} n - The number of times the returned function is allowed to call `func` before stopping.\n * - If `n` is 0, `func` will never be called.\n * - If `n` is a positive integer, `func` will be called up to `n-1` times.\n * @param {F} func - The function to be called with the limit applied.\n * @returns {F} - A new function that:\n * - Tracks the number of calls.\n * - Invokes `func` until the `n-1`-th call.\n * - Returns `undefined` if the number of calls reaches or exceeds `n`, stopping further calls.\n * @throws {Error} - Throw an error if `n` is negative.\n * @example\n *\n * const beforeFn = before(3, () => {\n * console.log(\"called\");\n * })\n *\n * // Will log 'called'.\n * beforeFn();\n *\n * // Will log 'called'.\n * beforeFn();\n *\n * // Will not log anything.\n * beforeFn();\n */\n\nexport const before = <F extends (...args: any[]) => any>(n: number, func: F): F => {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error('n must be a non-negative integer.');\n }\n\n let counter = 0;\n return ((...args: Parameters<F>) => {\n if (++counter < n) {\n return func(...args);\n }\n return undefined;\n }) as F;\n};\n"],"names":[],"mappings":"MA6Ba,MAAM,GAAG,CAAoC,CAAS,EAAE,IAAO,KAAO;AACjF,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;AAChB,IAAA,QAAQ,CAAC,GAAG,IAAmB,KAAI;AACjC,QAAA,IAAI,EAAE,OAAO,GAAG,CAAC,EAAE;AACjB,YAAA,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACtB;AACD,QAAA,OAAO,SAAS,CAAC;AACnB,KAAC,EAAO;AACV;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.mjs","sources":["../../src/function/debounce.ts"],"sourcesContent":["interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) ;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n"],"names":[],"mappings":"AAuCM,SAAU,QAAQ,CACtB,IAAO,EACP,UAAkB,EAClB,EAAE,MAAM,EAAA,GAAsB,EAAE,EAAA;IAEhC,IAAI,SAAS,GAAyC,IAAI,CAAC;AAE3D,IAAA,MAAM,SAAS,GAAG,UAAU,GAAG,IAAmB,EAAA;AAChD,QAAA,IAAI,SAAS,KAAK,IAAI,EAAE;YACtB,YAAY,CAAC,SAAS,CAAC,CAAC;SACzB;AAED,QAAA,IAAI,MAAM,EAAE,OAAO,EAAE;YACnB,OAAO;SACR;AAED,QAAA,SAAS,GAAG,UAAU,CAAC,MAAK;AAC1B,YAAA,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YACd,SAAS,GAAG,IAAI,CAAC;SAClB,EAAE,UAAU,CAAC,CAAE;AAClB,KAA+B,CAAC;AAEhC,IAAA,MAAM,OAAO,GAAG,YAAA;QACd,SAAS,CAAC,MAAM,EAAE,CAAC;AACrB,KAAC,CAAC;IAEF,SAAS,CAAC,MAAM,GAAG,YAAA;AACjB,QAAA,IAAI,SAAS,KAAK,IAAI,EAAE;YACtB,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,SAAS,GAAG,IAAI,CAAC;SAClB;AACH,KAAC,CAAC;AAEF,IAAA,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAE3D,IAAA,OAAO,SAAS,CAAC;AACnB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/function/before.ts","../../src/function/after.ts","../../src/function/debounce.ts","../../src/function/noop.ts","../../src/function/once.ts","../../src/function/throttle.ts","../../src/function/negate.ts"],"sourcesContent":["/**\n * Creates a function that limits the number of times the given function (`func`) can be called.\n *\n * @template F - The type of the function to be invoked.\n * @param {number} n - The number of times the returned function is allowed to call `func` before stopping.\n * - If `n` is 0, `func` will never be called.\n * - If `n` is a positive integer, `func` will be called up to `n-1` times.\n * @param {F} func - The function to be called with the limit applied.\n * @returns {F} - A new function that:\n * - Tracks the number of calls.\n * - Invokes `func` until the `n-1`-th call.\n * - Returns `undefined` if the number of calls reaches or exceeds `n`, stopping further calls.\n * @throws {Error} - Throw an error if `n` is negative.\n * @example\n *\n * const beforeFn = before(3, () => {\n * console.log(\"called\");\n * })\n *\n * // Will log 'called'.\n * beforeFn();\n *\n * // Will log 'called'.\n * beforeFn();\n *\n * // Will not log anything.\n * beforeFn();\n */\n\nexport const before = <F extends (...args: any[]) => any>(n: number, func: F): F => {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error('n must be a non-negative integer.');\n }\n\n let counter = 0;\n return ((...args: Parameters<F>) => {\n if (++counter < n) {\n return func(...args);\n }\n return undefined;\n }) as F;\n};\n","/**\n * Creates a function that only executes starting from the `n`-th call.\n * The provided function will be invoked starting from the `n`-th call.\n *\n * This is particularly useful for scenarios involving events or asynchronous operations\n * where an action should occur only after a certain number of invocations.\n *\n * @template F - The type of the function to be invoked.\n * @param {number} n - The number of calls required for `func` to execute.\n * @param {F} func - The function to be invoked.\n * @returns {F} - A new function that:\n * - Tracks the number of calls.\n * - Invokes `func` starting from the `n`-th call.\n * - Returns `undefined` if fewer than `n` calls have been made.\n * @throws {Error} - Throws an error if `n` is negative.\n * @example\n *\n * const afterFn = after(3, () => {\n * console.log(\"called\")\n * });\n *\n * // Will not log anything.\n * afterFn()\n * // Will not log anything.\n * afterFn()\n * // Will log 'called'.\n * afterFn()\n */\n\nexport const after = <F extends (...args: any[]) => any>(n: number, func: F): F => {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error(`n must be a non-negative integer.`);\n }\n\n let counter = 0;\n return ((...args: Parameters<F>) => {\n if (++counter >= n) {\n return func(...args);\n }\n return undefined;\n }) as F;\n};\n","interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) ;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n","/**\n * A no-operation function that does nothing.\n * This can be used as a placeholder or default function.\n *\n * @example\n * noop(); // Does nothing\n *\n * @returns {void} This function does not return anything.\n */\nexport function noop(): void {}\n","/**\n * Creates a function that is restricted to invoking the provided function `func` once.\n * Repeated calls to the function will return the value from the first invocation.\n *\n * @template F - The type of function.\n * @param {F} func - The function to restrict.\n * @returns {F} A new function that invokes `func` once and caches the result.\n *\n * @example\n * const initialize = once(() => {\n * console.log('Initialized!');\n * return true;\n * });\n *\n * initialize(); // Logs: 'Initialized!' and returns true\n * initialize(); // Returns true without logging\n */\nexport function once<F extends () => any>(func: F): F {\n let called = false;\n let cache: ReturnType<F> | undefined;\n\n return function () {\n if (called) {\n return cache;\n }\n\n const result = func();\n\n called = true;\n cache = result;\n\n return result;\n } as F;\n}\n","/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @template F - The type of function.\n * @param {F} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {F} A new throttled function that accepts the same parameters as the original function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n *\n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n *\n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle<F extends (...args: any[]) => void>(func: F, throttleMs: number): F {\n let lastCallTime: number | null;\n\n const throttledFunction = function (...args: Parameters<F>) {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func(...args);\n }\n } as F;\n\n return throttledFunction;\n}\n","/**\n * Creates a function that negates the result of the predicate function.\n *\n * @template F - The type of the function to negate.\n * @param {F} func - The function to negate.\n * @returns {F} The new negated function, which negates the boolean result of `func`.\n */\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"names":[],"mappings":";;;;MA6Ba,MAAM,GAAG,CAAoC,CAAS,EAAE,IAAO,KAAO;AACjF,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;AAChB,IAAA,QAAQ,CAAC,GAAG,IAAmB,KAAI;AACjC,QAAA,IAAI,EAAE,OAAO,GAAG,CAAC,EAAE;AACjB,YAAA,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACtB;AACD,QAAA,OAAO,SAAS,CAAC;AACnB,KAAC,EAAO;AACV;;MCZa,KAAK,GAAG,CAAoC,CAAS,EAAE,IAAO,KAAO;AAChF,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,iCAAA,CAAmC,CAAC,CAAC;KACtD;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;AAChB,IAAA,QAAQ,CAAC,GAAG,IAAmB,KAAI;AACjC,QAAA,IAAI,EAAE,OAAO,IAAI,CAAC,EAAE;AAClB,YAAA,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACtB;AACD,QAAA,OAAO,SAAS,CAAC;AACnB,KAAC,EAAO;AACV;;ACFM,SAAU,QAAQ,CACtB,IAAO,EACP,UAAkB,EAClB,EAAE,MAAM,EAAA,GAAsB,EAAE,EAAA;IA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AA,IAAI,YAA2B,CAAC;AAEhC,IAAA,MAAM,iBAAiB,GAAG,UAAU,GAAG,IAAmB,EAAA;AACxD,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI,YAAY,IAAI,IAAI,IAAI,GAAG,GAAG,YAAY,IAAI,UAAU,EAAE;YAC5D,YAAY,GAAG,GAAG,CAAC;AACnB,YAAA,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACf;AACH,KAAM,CAAC;AAEP,IAAA,OAAO,iBAAiB,CAAC;AAC3B;;AChCM,SAAU,MAAM,CAA4C,IAAO,EAAA;AACrE,IAAA,QAAQ,CAAC,GAAG,IAAW,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAO;AACrD;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negate.mjs","sources":["../../src/function/negate.ts"],"sourcesContent":["/**\n * Creates a function that negates the result of the predicate function.\n *\n * @template F - The type of the function to negate.\n * @param {F} func - The function to negate.\n * @returns {F} The new negated function, which negates the boolean result of `func`.\n */\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"names":[],"mappings":"AAOM,SAAU,MAAM,CAA4C,IAAO,EAAA;AACrE,IAAA,QAAQ,CAAC,GAAG,IAAW,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAO;AACrD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noop.mjs","sources":["../../src/function/noop.ts"],"sourcesContent":["/**\n * A no-operation function that does nothing.\n * This can be used as a placeholder or default function.\n *\n * @example\n * noop(); // Does nothing\n *\n * @returns {void} This function does not return anything.\n */\nexport function noop(): void {}\n"],"names":[],"mappings":"AASM,SAAU,IAAI,GAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"once.mjs","sources":["../../src/function/once.ts"],"sourcesContent":["/**\n * Creates a function that is restricted to invoking the provided function `func` once.\n * Repeated calls to the function will return the value from the first invocation.\n *\n * @template F - The type of function.\n * @param {F} func - The function to restrict.\n * @returns {F} A new function that invokes `func` once and caches the result.\n *\n * @example\n * const initialize = once(() => {\n * console.log('Initialized!');\n * return true;\n * });\n *\n * initialize(); // Logs: 'Initialized!' and returns true\n * initialize(); // Returns true without logging\n */\nexport function once<F extends () => any>(func: F): F {\n let called = false;\n let cache: ReturnType<F> | undefined;\n\n return function () {\n if (called) {\n return cache;\n }\n\n const result = func();\n\n called = true;\n cache = result;\n\n return result;\n } as F;\n}\n"],"names":[],"mappings":"AAiBM,SAAU,IAAI,CAAsB,IAAO,EAAA;IAC/C,IAAI,MAAM,GAAG,KAAK,CAAC;AACnB,IAAA,IAAI,KAAgC,CAAC;IAErC,OAAO,YAAA;QACL,IAAI,MAAM,EAAE;AACV,YAAA,OAAO,KAAK,CAAC;SACd;AAED,QAAA,MAAM,MAAM,GAAG,IAAI,EAAE,CAAC;QAEtB,MAAM,GAAG,IAAI,CAAC;QACd,KAAK,GAAG,MAAM,CAAC;AAEf,QAAA,OAAO,MAAM,CAAC;AAChB,KAAM,CAAC;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.mjs","sources":["../../src/function/throttle.ts"],"sourcesContent":["/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @template F - The type of function.\n * @param {F} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {F} A new throttled function that accepts the same parameters as the original function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n *\n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n *\n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle<F extends (...args: any[]) => void>(func: F, throttleMs: number): F {\n let lastCallTime: number | null;\n\n const throttledFunction = function (...args: Parameters<F>) {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func(...args);\n }\n } as F;\n\n return throttledFunction;\n}\n"],"names":[],"mappings":"AA0BgB,SAAA,QAAQ,CAAqC,IAAO,EAAE,UAAkB,EAAA;AACtF,IAAA,IAAI,YAA2B,CAAC;AAEhC,IAAA,MAAM,iBAAiB,GAAG,UAAU,GAAG,IAAmB,EAAA;AACxD,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI,YAAY,IAAI,IAAI,IAAI,GAAG,GAAG,YAAY,IAAI,UAAU,EAAE;YAC5D,YAAY,GAAG,GAAG,CAAC;AACnB,YAAA,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACf;AACH,KAAM,CAAC;AAEP,IAAA,OAAO,iBAAiB,CAAC;AAC3B;;;;"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/math/clamp.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.mjs","sources":["../../src/math/clamp.ts"],"sourcesContent":["/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n"],"names":[],"mappings":"SAmBgB,KAAK,CAAC,KAAa,EAAE,MAAc,EAAE,MAAe,EAAA;AAClE,IAAA,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAChC;AAED,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AACnD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inRange.mjs","sources":["../../src/math/inRange.ts"],"sourcesContent":["export function inRange(value: number, maximum: number): boolean;\nexport function inRange(value: number, minimum: number, maximum: number): boolean;\n/**\n * Checks if the value is within a specified range.\n *\n * @param {number} value The value to check.\n * @param {number} minimum The lower bound of the range (inclusive).\n * @param {number} maximum The upper bound of the range (exclusive).\n * @returns {boolean} `true` if the value is within the specified range, otherwise `false`.\n * @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.\n *\n * @example\n * const result1 = inRange(3, 5); // result1 will be true.\n * const result2 = inRange(1, 2, 5); // result2 will be false.\n * const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.\n */\nexport function inRange(value: number, minimum: number, maximum?: number): boolean {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('The maximum value must be greater than the minimum value.');\n }\n\n return minimum <= value && value < maximum;\n}\n"],"names":[],"mappings":"SAgBgB,OAAO,CAAC,KAAa,EAAE,OAAe,EAAE,OAAgB,EAAA;AACtE,IAAA,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,OAAO,CAAC;QAClB,OAAO,GAAG,CAAC,CAAC;KACb;AAED,IAAA,IAAI,OAAO,IAAI,OAAO,EAAE;AACtB,QAAA,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;KAC9E;AAED,IAAA,OAAO,OAAO,IAAI,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC;AAC7C;;;;"}
|
package/dist/math/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/math/clamp.ts","../../src/math/inRange.ts","../../src/math/sum.ts","../../src/math/mean.ts","../../src/math/meanBy.ts","../../src/math/round.ts","../../src/math/sumBy.ts","../../src/math/range.ts"],"sourcesContent":["/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n","export function inRange(value: number, maximum: number): boolean;\nexport function inRange(value: number, minimum: number, maximum: number): boolean;\n/**\n * Checks if the value is within a specified range.\n *\n * @param {number} value The value to check.\n * @param {number} minimum The lower bound of the range (inclusive).\n * @param {number} maximum The upper bound of the range (exclusive).\n * @returns {boolean} `true` if the value is within the specified range, otherwise `false`.\n * @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.\n *\n * @example\n * const result1 = inRange(3, 5); // result1 will be true.\n * const result2 = inRange(1, 2, 5); // result2 will be false.\n * const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.\n */\nexport function inRange(value: number, minimum: number, maximum?: number): boolean {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('The maximum value must be greater than the minimum value.');\n }\n\n return minimum <= value && value < maximum;\n}\n","/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (let i = 0; i < nums.length; i++) {\n result += nums[i];\n }\n\n return result;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = mean(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n","import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n","/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n","import { sum } from './sum.ts';\n\n/**\n * Calculates the sum of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `0`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * sumBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 6\n * sumBy([], x => x.a); // Returns: 0\n */\nexport function sumBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return sum(nums);\n}\n","/**\n * Returns an array of numbers from `start` to `end`, incrementing by `step`.\n *\n * If `step` is not provided, it defaults to `1`.\n *\n * @param {number} start - The starting number of the range (inclusive).\n * @param {number} [end] - The end number of the range (exclusive).\n * @param {number} [step] - The step value for the range. (default: 1)\n * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.\n *\n * @example\n * // Returns [0, 1, 2, 3]\n * range(4);\n *\n * @example\n * // Returns [0, 5, 10, 15]\n * range(0, 20, 5);\n *\n * @example\n * // Returns [0, -1, -2, -3]\n * range(0, -4, -1);\n *\n * @example\n * // Throws an error: The step value must be a non-zero integer.\n * range(1, 4, 0);\n */\nexport function range(end: number): number[];\nexport function range(start: number, end: number): number[];\nexport function range(start: number, end: number, step: number): number[];\nexport function range(start: number, end?: number, step?: number): number[] {\n if (end == null) {\n end = start;\n start = 0;\n }\n\n if (step == null) {\n step = 1;\n }\n\n if (!Number.isInteger(step) || step === 0) {\n throw new Error(`The step value must be a non-zero integer.`);\n }\n\n const length = Math.max(Math.ceil((end - start) / step), 0);\n const result = new Array(length);\n\n for (let i = 0; i < length; i++) {\n result[i] = start + i * step;\n }\n\n return result;\n}\n"],"names":[],"mappings":";;;;;;SAmBgB,KAAK,CAAC,KAAa,EAAE,MAAc,EAAE,MAAe,EAAA;AAClE,IAAA,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAChC;AAED,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AACnD;;SCTgB,OAAO,CAAC,KA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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mean.mjs","sources":["../../src/math/mean.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = mean(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n"],"names":[],"mappings":";;AAeM,SAAU,IAAI,CAAC,IAAuB,EAAA;IAC1C,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;AACjC;;;;"}
|
package/dist/math/meanBy.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meanBy.mjs","sources":["../../src/math/meanBy.ts"],"sourcesContent":["import { mean } from './mean.ts';\n\n/**\n * Calculates the average of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2\n * meanBy([], x => x.a); // Returns: NaN\n */\nexport function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return mean(nums);\n}\n"],"names":[],"mappings":";;AAiBgB,SAAA,MAAM,CAAI,KAAmB,EAAE,QAAgC,EAAA;AAC7E,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzC,IAAA,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB;;;;"}
|
package/dist/math/random.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"random.mjs","sources":["../../src/math/random.ts"],"sourcesContent":["/**\n * Generate a random number within the given range.\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result1 = random(0, 5); // Returns a random number between 0 and 5.\n * const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown\n * const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.\n */\nexport function random(maximum: number): number;\nexport function random(minimum: number, maximum: number): number;\nexport function random(minimum: number, maximum?: number): number {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n"],"names":[],"mappings":"AAiBgB,SAAA,MAAM,CAAC,OAAe,EAAE,OAAgB,EAAA;AACtD,IAAA,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,OAAO,CAAC;QAClB,OAAO,GAAG,CAAC,CAAC;KACb;AAED,IAAA,IAAI,OAAO,IAAI,OAAO,EAAE;AACtB,QAAA,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;KAC7F;AAED,IAAA,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC;AACvD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"randomInt.mjs","sources":["../../src/math/randomInt.ts"],"sourcesContent":["import { random } from './random.ts';\n\n/**\n * Generates a random integer between minimum (inclusive) and maximum (exclusive).\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)\n * const result2 = randomInt(5, 0); // This will throw an error\n */\nexport function randomInt(maximum: number): number;\nexport function randomInt(minimum: number, maximum: number): number;\nexport function randomInt(minimum: number, maximum?: number): number {\n return Math.floor(random(minimum, maximum!));\n}\n"],"names":[],"mappings":";;AAkBgB,SAAA,SAAS,CAAC,OAAe,EAAE,OAAgB,EAAA;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAQ,CAAC,CAAC,CAAC;AAC/C;;;;"}
|
package/dist/math/range.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range.mjs","sources":["../../src/math/range.ts"],"sourcesContent":["/**\n * Returns an array of numbers from `start` to `end`, incrementing by `step`.\n *\n * If `step` is not provided, it defaults to `1`.\n *\n * @param {number} start - The starting number of the range (inclusive).\n * @param {number} [end] - The end number of the range (exclusive).\n * @param {number} [step] - The step value for the range. (default: 1)\n * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.\n *\n * @example\n * // Returns [0, 1, 2, 3]\n * range(4);\n *\n * @example\n * // Returns [0, 5, 10, 15]\n * range(0, 20, 5);\n *\n * @example\n * // Returns [0, -1, -2, -3]\n * range(0, -4, -1);\n *\n * @example\n * // Throws an error: The step value must be a non-zero integer.\n * range(1, 4, 0);\n */\nexport function range(end: number): number[];\nexport function range(start: number, end: number): number[];\nexport function range(start: number, end: number, step: number): number[];\nexport function range(start: number, end?: number, step?: number): number[] {\n if (end == null) {\n end = start;\n start = 0;\n }\n\n if (step == null) {\n step = 1;\n }\n\n if (!Number.isInteger(step) || step === 0) {\n throw new Error(`The step value must be a non-zero integer.`);\n }\n\n const length = Math.max(Math.ceil((end - start) / step), 0);\n const result = new Array(length);\n\n for (let i = 0; i < length; i++) {\n result[i] = start + i * step;\n }\n\n return result;\n}\n"],"names":[],"mappings":"SA6BgB,KAAK,CAAC,KAAa,EAAE,GAAY,EAAE,IAAa,EAAA;AAC9D,IAAA,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,GAAG,GAAG,KAAK,CAAC;QACZ,KAAK,GAAG,CAAC,CAAC;KACX;AAED,IAAA,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,IAAI,GAAG,CAAC,CAAC;KACV;AAED,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE;AACzC,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,0CAAA,CAA4C,CAAC,CAAC;KAC/D;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5D,IAAA,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AAEjC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC;KAC9B;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/math/round.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"round.mjs","sources":["../../src/math/round.ts"],"sourcesContent":["/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n"],"names":[],"mappings":"SAiBgB,KAAK,CAAC,KAAa,EAAE,SAAS,GAAG,CAAC,EAAA;IAChD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE;AAChC,QAAA,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;AACrD;;;;"}
|
package/dist/math/sum.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sum.mjs","sources":["../../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (let i = 0; i < nums.length; i++) {\n result += nums[i];\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAaM,SAAU,GAAG,CAAC,IAAuB,EAAA;IACzC,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;KACnB;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/math/sumBy.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sumBy.mjs","sources":["../../src/math/sumBy.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the sum of an array of numbers when applying\n * the `getValue` function to each element.\n *\n * If the array is empty, this function returns `0`.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items An array to calculate the average.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {number} The average of all the numbers as determined by the `getValue` function.\n *\n * @example\n * sumBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 6\n * sumBy([], x => x.a); // Returns: 0\n */\nexport function sumBy<T>(items: readonly T[], getValue: (element: T) => number): number {\n const nums = items.map(x => getValue(x));\n\n return sum(nums);\n}\n"],"names":[],"mappings":";;AAiBgB,SAAA,KAAK,CAAI,KAAmB,EAAE,QAAgC,EAAA;AAC5E,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzC,IAAA,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;AACnB;;;;"}
|