es-toolkit 1.13.1-dev.339 → 1.13.1-dev.344

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.
@@ -0,0 +1,25 @@
1
+ import { isMatch } from '../predicate/isMatch.mjs';
2
+
3
+ function isArrayMatch(target, source) {
4
+ if (source.length === 0) {
5
+ return true;
6
+ }
7
+ if (!Array.isArray(target)) {
8
+ return false;
9
+ }
10
+ const countedIndex = new Set();
11
+ for (let i = 0; i < source.length; i++) {
12
+ const sourceItem = source[i];
13
+ const index = target.findIndex((targetItem, index) => {
14
+ return isMatch(targetItem, sourceItem) && !countedIndex.has(index);
15
+ });
16
+ if (index === -1) {
17
+ return false;
18
+ }
19
+ countedIndex.add(index);
20
+ }
21
+ return true;
22
+ }
23
+
24
+ export { isArrayMatch };
25
+ //# sourceMappingURL=isArrayMatch.mjs.map
@@ -0,0 +1 @@
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;;;;"}
@@ -0,0 +1,19 @@
1
+ import { isMatch } from '../predicate/isMatch.mjs';
2
+
3
+ function isMapMatch(target, source) {
4
+ if (source.size === 0) {
5
+ return true;
6
+ }
7
+ if (!(target instanceof Map)) {
8
+ return false;
9
+ }
10
+ for (const [key, value] of source.entries()) {
11
+ if (!isMatch(target.get(key), value)) {
12
+ return false;
13
+ }
14
+ }
15
+ return true;
16
+ }
17
+
18
+ export { isMapMatch };
19
+ //# sourceMappingURL=isMapMatch.mjs.map
@@ -0,0 +1 @@
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;;;;"}
@@ -0,0 +1,14 @@
1
+ import { isArrayMatch } from './isArrayMatch.mjs';
2
+
3
+ function isSetMatch(target, source) {
4
+ if (source.size === 0) {
5
+ return true;
6
+ }
7
+ if (!(target instanceof Set)) {
8
+ return false;
9
+ }
10
+ return isArrayMatch([...target], [...source]);
11
+ }
12
+
13
+ export { isSetMatch };
14
+ //# sourceMappingURL=isSetMatch.mjs.map
@@ -0,0 +1 @@
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;;;;"}
@@ -99,6 +99,8 @@ export { set } from './object/set.mjs';
99
99
  export { isPlainObject } from './predicate/isPlainObject.mjs';
100
100
  export { isArray } from './predicate/isArray.mjs';
101
101
  export { isTypedArray } from './predicate/isTypedArray.mjs';
102
+ export { isMatch } from './predicate/isMatch.mjs';
103
+ export { matches } from './predicate/matches.mjs';
102
104
  export { startsWith } from './string/startsWith.mjs';
103
105
  export { endsWith } from './string/endsWith.mjs';
104
106
  export { max } from './math/max.mjs';
@@ -99,6 +99,8 @@ export { set } from './object/set.js';
99
99
  export { isPlainObject } from './predicate/isPlainObject.js';
100
100
  export { isArray } from './predicate/isArray.js';
101
101
  export { isTypedArray } from './predicate/isTypedArray.js';
102
+ export { isMatch } from './predicate/isMatch.js';
103
+ export { matches } from './predicate/matches.js';
102
104
  export { startsWith } from './string/startsWith.js';
103
105
  export { endsWith } from './string/endsWith.js';
104
106
  export { max } from './math/max.js';
@@ -207,6 +207,111 @@ function isTypedArray(x) {
207
207
  return predicate_index.isTypedArray(x);
208
208
  }
209
209
 
210
+ function isArrayMatch(target, source) {
211
+ if (source.length === 0) {
212
+ return true;
213
+ }
214
+ if (!Array.isArray(target)) {
215
+ return false;
216
+ }
217
+ const countedIndex = new Set();
218
+ for (let i = 0; i < source.length; i++) {
219
+ const sourceItem = source[i];
220
+ const index = target.findIndex((targetItem, index) => {
221
+ return isMatch(targetItem, sourceItem) && !countedIndex.has(index);
222
+ });
223
+ if (index === -1) {
224
+ return false;
225
+ }
226
+ countedIndex.add(index);
227
+ }
228
+ return true;
229
+ }
230
+
231
+ function isMapMatch(target, source) {
232
+ if (source.size === 0) {
233
+ return true;
234
+ }
235
+ if (!(target instanceof Map)) {
236
+ return false;
237
+ }
238
+ for (const [key, value] of source.entries()) {
239
+ if (!isMatch(target.get(key), value)) {
240
+ return false;
241
+ }
242
+ }
243
+ return true;
244
+ }
245
+
246
+ function isSetMatch(target, source) {
247
+ if (source.size === 0) {
248
+ return true;
249
+ }
250
+ if (!(target instanceof Set)) {
251
+ return false;
252
+ }
253
+ return isArrayMatch([...target], [...source]);
254
+ }
255
+
256
+ function isMatch(target, source) {
257
+ if (source === target) {
258
+ return true;
259
+ }
260
+ switch (typeof source) {
261
+ case 'object': {
262
+ if (source == null) {
263
+ return true;
264
+ }
265
+ source = source ?? {};
266
+ const keys = Object.keys(source);
267
+ if (target == null) {
268
+ if (keys.length === 0) {
269
+ return true;
270
+ }
271
+ return false;
272
+ }
273
+ if (Array.isArray(source)) {
274
+ return isArrayMatch(target, source);
275
+ }
276
+ if (source instanceof Map) {
277
+ return isMapMatch(target, source);
278
+ }
279
+ if (source instanceof Set) {
280
+ return isSetMatch(target, source);
281
+ }
282
+ for (let i = 0; i < keys.length; i++) {
283
+ const key = keys[i];
284
+ if (!predicate_index.isPrimitive(target) && !(key in target)) {
285
+ return false;
286
+ }
287
+ if (source[key] === undefined && target[key] !== undefined) {
288
+ return false;
289
+ }
290
+ if (!isMatch(target[key], source[key])) {
291
+ return false;
292
+ }
293
+ }
294
+ return true;
295
+ }
296
+ case 'function': {
297
+ if (Object.keys(source).length > 0) {
298
+ return isMatch(target, { ...source });
299
+ }
300
+ return false;
301
+ }
302
+ default: {
303
+ return !source;
304
+ }
305
+ }
306
+ }
307
+
308
+ function matches(source) {
309
+ source = object_index.cloneDeep(source);
310
+ return (target) => {
311
+ return isMatch(target, source);
312
+ };
313
+ }
314
+
210
315
  const startsWith = (str, target, position = 0) => {
211
316
  return str.startsWith(target, position);
212
317
  };
@@ -338,8 +443,10 @@ exports.endsWith = endsWith;
338
443
  exports.fill = fill;
339
444
  exports.get = get;
340
445
  exports.isArray = isArray;
446
+ exports.isMatch = isMatch;
341
447
  exports.isPlainObject = isPlainObject;
342
448
  exports.isTypedArray = isTypedArray;
449
+ exports.matches = matches;
343
450
  exports.max = max;
344
451
  exports.min = min;
345
452
  exports.set = set;
@@ -1 +1 @@
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/predicate/isPlainObject.ts","../../src/compat/predicate/isArray.ts","../../src/compat/predicate/isTypedArray.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}","/**\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","/**\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","isTypedArrayToolkit"],"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,CAAC,GAAG,EAAE;QACR,G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EAAE,QAAQ,CAAC,CAAC;AACxC;;ACFgB,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;;ACZgB,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
+ {"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/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}","/**\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}\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,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;;ACZgB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -99,6 +99,8 @@ export { set } from './object/set.mjs';
99
99
  export { isPlainObject } from './predicate/isPlainObject.mjs';
100
100
  export { isArray } from './predicate/isArray.mjs';
101
101
  export { isTypedArray } from './predicate/isTypedArray.mjs';
102
+ export { isMatch } from './predicate/isMatch.mjs';
103
+ export { matches } from './predicate/matches.mjs';
102
104
  export { startsWith } from './string/startsWith.mjs';
103
105
  export { endsWith } from './string/endsWith.mjs';
104
106
  export { max } from './math/max.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Checks if the target matches the source by comparing their structures and values.
3
+ * This function supports deep comparison for objects, arrays, maps, and sets.
4
+ *
5
+ * @param {unknown} target - The target value to match against.
6
+ * @param {unknown} source - The source value to match with.
7
+ * @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`.
8
+ *
9
+ * @example
10
+ * // Basic usage
11
+ * isMatch({ a: 1, b: 2 }, { a: 1 }); // true
12
+ *
13
+ * @example
14
+ * // Matching arrays
15
+ * isMatch([1, 2, 3], [1, 2, 3]); // true
16
+ *
17
+ * @example
18
+ * // Matching maps
19
+ * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]);
20
+ * const sourceMap = new Map([['key1', 'value1']]);
21
+ * isMatch(targetMap, sourceMap); // true
22
+ *
23
+ * @example
24
+ * // Matching sets
25
+ * const targetSet = new Set([1, 2, 3]);
26
+ * const sourceSet = new Set([1, 2]);
27
+ * isMatch(targetSet, sourceSet); // true
28
+ */
29
+ declare function isMatch(target: unknown, source: unknown): boolean;
30
+
31
+ export { isMatch };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Checks if the target matches the source by comparing their structures and values.
3
+ * This function supports deep comparison for objects, arrays, maps, and sets.
4
+ *
5
+ * @param {unknown} target - The target value to match against.
6
+ * @param {unknown} source - The source value to match with.
7
+ * @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`.
8
+ *
9
+ * @example
10
+ * // Basic usage
11
+ * isMatch({ a: 1, b: 2 }, { a: 1 }); // true
12
+ *
13
+ * @example
14
+ * // Matching arrays
15
+ * isMatch([1, 2, 3], [1, 2, 3]); // true
16
+ *
17
+ * @example
18
+ * // Matching maps
19
+ * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]);
20
+ * const sourceMap = new Map([['key1', 'value1']]);
21
+ * isMatch(targetMap, sourceMap); // true
22
+ *
23
+ * @example
24
+ * // Matching sets
25
+ * const targetSet = new Set([1, 2, 3]);
26
+ * const sourceSet = new Set([1, 2]);
27
+ * isMatch(targetSet, sourceSet); // true
28
+ */
29
+ declare function isMatch(target: unknown, source: unknown): boolean;
30
+
31
+ export { isMatch };
@@ -0,0 +1,59 @@
1
+ import { isPrimitive } from '../../predicate/isPrimitive.mjs';
2
+ import { isArrayMatch } from '../_internal/isArrayMatch.mjs';
3
+ import { isMapMatch } from '../_internal/isMapMatch.mjs';
4
+ import { isSetMatch } from '../_internal/isSetMatch.mjs';
5
+
6
+ function isMatch(target, source) {
7
+ if (source === target) {
8
+ return true;
9
+ }
10
+ switch (typeof source) {
11
+ case 'object': {
12
+ if (source == null) {
13
+ return true;
14
+ }
15
+ source = source ?? {};
16
+ const keys = Object.keys(source);
17
+ if (target == null) {
18
+ if (keys.length === 0) {
19
+ return true;
20
+ }
21
+ return false;
22
+ }
23
+ if (Array.isArray(source)) {
24
+ return isArrayMatch(target, source);
25
+ }
26
+ if (source instanceof Map) {
27
+ return isMapMatch(target, source);
28
+ }
29
+ if (source instanceof Set) {
30
+ return isSetMatch(target, source);
31
+ }
32
+ for (let i = 0; i < keys.length; i++) {
33
+ const key = keys[i];
34
+ if (!isPrimitive(target) && !(key in target)) {
35
+ return false;
36
+ }
37
+ if (source[key] === undefined && target[key] !== undefined) {
38
+ return false;
39
+ }
40
+ if (!isMatch(target[key], source[key])) {
41
+ return false;
42
+ }
43
+ }
44
+ return true;
45
+ }
46
+ case 'function': {
47
+ if (Object.keys(source).length > 0) {
48
+ return isMatch(target, { ...source });
49
+ }
50
+ return false;
51
+ }
52
+ default: {
53
+ return !source;
54
+ }
55
+ }
56
+ }
57
+
58
+ export { isMatch };
59
+ //# sourceMappingURL=isMatch.mjs.map
@@ -0,0 +1 @@
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}\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,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;;;;"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Creates a function that performs a deep comparison between a given target and the source object.
3
+ *
4
+ * @param {unknown} source - The source object to create the matcher from.
5
+ * @returns {(target: unknown) => boolean} - Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`.
6
+ *
7
+ * @example
8
+ * // Basic usage
9
+ * const matcher = matches({ a: 1, b: 2 });
10
+ * matcher({ a: 1, b: 2, c: 3 }); // true
11
+ * matcher({ a: 1, c: 3 }); // false
12
+ *
13
+ * @example
14
+ * // Matching arrays
15
+ * const arrayMatcher = matches([1, 2, 3]);
16
+ * arrayMatcher([1, 2, 3, 4]); // true
17
+ * arrayMatcher([4, 5, 6]); // false
18
+ *
19
+ * @example
20
+ * // Matching objects with nested structures
21
+ * const nestedMatcher = matches({ a: { b: 2 } });
22
+ * nestedMatcher({ a: { b: 2, c: 3 } }); // true
23
+ * nestedMatcher({ a: { c: 3 } }); // false
24
+ */
25
+ declare function matches(source: unknown): (target: unknown) => boolean;
26
+
27
+ export { matches };