es-toolkit 1.25.2-dev.819 → 1.25.2-dev.821

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.
@@ -1,4 +1,4 @@
1
- import { identity } from '../_internal/identity.mjs';
1
+ import { identity } from '../../function/identity.mjs';
2
2
  import { isIterateeCall } from '../_internal/isIterateeCall.mjs';
3
3
  import { property } from '../object/property.mjs';
4
4
  import { matches } from '../predicate/matches.mjs';
@@ -1,4 +1,4 @@
1
- import { identity } from '../_internal/identity.mjs';
1
+ import { identity } from '../../function/identity.mjs';
2
2
  import { property } from '../object/property.mjs';
3
3
  import { isArray } from '../predicate/isArray.mjs';
4
4
  import { matches } from '../predicate/matches.mjs';
@@ -1,7 +1,7 @@
1
1
  import { intersectionBy as intersectionBy$1 } from '../../array/intersectionBy.mjs';
2
2
  import { last } from '../../array/last.mjs';
3
3
  import { uniq } from '../../array/uniq.mjs';
4
- import { identity } from '../_internal/identity.mjs';
4
+ import { identity } from '../../function/identity.mjs';
5
5
  import { property } from '../object/property.mjs';
6
6
  import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
7
7
 
@@ -63,7 +63,6 @@ declare function some<T>(arr: ArrayLike<T> | null | undefined, propertyToCheck:
63
63
  */
64
64
  declare function some<T>(arr: ArrayLike<T> | null | undefined, doesMatch: Partial<T>): boolean;
65
65
  /**
66
- *
67
66
  * Checks if there is an element in an object that matches the given predicate function.
68
67
  *
69
68
  * @template T
@@ -76,7 +75,6 @@ declare function some<T>(arr: ArrayLike<T> | null | undefined, doesMatch: Partia
76
75
  */
77
76
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined): boolean;
78
77
  /**
79
- *
80
78
  * Checks if there is an element in an object that matches the given predicate function.
81
79
  *
82
80
  * @template T
@@ -90,7 +88,6 @@ declare function some<T extends Record<string, unknown>>(object: T | null | unde
90
88
  */
91
89
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined, doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown): boolean;
92
90
  /**
93
- *
94
91
  * Checks if there is an element in an object that matches the given partial value.
95
92
  *
96
93
  * @template T
@@ -104,7 +101,6 @@ declare function some<T extends Record<string, unknown>>(object: T | null | unde
104
101
  */
105
102
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined, doesMatch: Partial<T[keyof T]>): boolean;
106
103
  /**
107
- *
108
104
  * Checks if there is an element in an object that matches a property with a specific value.
109
105
  *
110
106
  * @template T
@@ -119,7 +115,6 @@ declare function some<T extends Record<string, unknown>>(object: T | null | unde
119
115
  */
120
116
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined, doesMatchProperty: [keyof T[keyof T], unknown]): boolean;
121
117
  /**
122
- *
123
118
  * Checks if there is an element in an object that has a specific property, where the property name is provided as a string.
124
119
  *
125
120
  * @template T
@@ -63,7 +63,6 @@ declare function some<T>(arr: ArrayLike<T> | null | undefined, propertyToCheck:
63
63
  */
64
64
  declare function some<T>(arr: ArrayLike<T> | null | undefined, doesMatch: Partial<T>): boolean;
65
65
  /**
66
- *
67
66
  * Checks if there is an element in an object that matches the given predicate function.
68
67
  *
69
68
  * @template T
@@ -76,7 +75,6 @@ declare function some<T>(arr: ArrayLike<T> | null | undefined, doesMatch: Partia
76
75
  */
77
76
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined): boolean;
78
77
  /**
79
- *
80
78
  * Checks if there is an element in an object that matches the given predicate function.
81
79
  *
82
80
  * @template T
@@ -90,7 +88,6 @@ declare function some<T extends Record<string, unknown>>(object: T | null | unde
90
88
  */
91
89
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined, doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown): boolean;
92
90
  /**
93
- *
94
91
  * Checks if there is an element in an object that matches the given partial value.
95
92
  *
96
93
  * @template T
@@ -104,7 +101,6 @@ declare function some<T extends Record<string, unknown>>(object: T | null | unde
104
101
  */
105
102
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined, doesMatch: Partial<T[keyof T]>): boolean;
106
103
  /**
107
- *
108
104
  * Checks if there is an element in an object that matches a property with a specific value.
109
105
  *
110
106
  * @template T
@@ -119,7 +115,6 @@ declare function some<T extends Record<string, unknown>>(object: T | null | unde
119
115
  */
120
116
  declare function some<T extends Record<string, unknown>>(object: T | null | undefined, doesMatchProperty: [keyof T[keyof T], unknown]): boolean;
121
117
  /**
122
- *
123
118
  * Checks if there is an element in an object that has a specific property, where the property name is provided as a string.
124
119
  *
125
120
  * @template T
@@ -1,4 +1,4 @@
1
- import { identity } from '../_internal/identity.mjs';
1
+ import { identity } from '../../function/identity.mjs';
2
2
  import { property } from '../object/property.mjs';
3
3
  import { matches } from '../predicate/matches.mjs';
4
4
  import { matchesProperty } from '../predicate/matchesProperty.mjs';
@@ -11,7 +11,7 @@
11
11
  * @template V - The type of values corresponding to the property paths.
12
12
  * @param {ArrayLike<P | P[]>} keys - An array of property paths, each path can be a dot-separated string or an array of property names.
13
13
  * @param {ArrayLike<V>} values - An array of values corresponding to the property paths.
14
- * @returns {{ [K in P]: V }} A new object composed of the given property paths and values.
14
+ * @returns {Record<P, V>} A new object composed of the given property paths and values.
15
15
  *
16
16
  * @example
17
17
  * const paths = ['a.b.c', 'd.e.f'];
@@ -31,8 +31,6 @@
31
31
  * const result = zipObjectDeep(paths, values);
32
32
  * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
33
33
  */
34
- declare function zipObjectDeep<P extends PropertyKey, V>(keys: ArrayLike<P | P[]>, values: ArrayLike<V>): {
35
- [K in P]: V;
36
- };
34
+ declare function zipObjectDeep<P extends PropertyKey, V>(keys: ArrayLike<P | P[]>, values: ArrayLike<V>): Record<P, V>;
37
35
 
38
36
  export { zipObjectDeep };
@@ -11,7 +11,7 @@
11
11
  * @template V - The type of values corresponding to the property paths.
12
12
  * @param {ArrayLike<P | P[]>} keys - An array of property paths, each path can be a dot-separated string or an array of property names.
13
13
  * @param {ArrayLike<V>} values - An array of values corresponding to the property paths.
14
- * @returns {{ [K in P]: V }} A new object composed of the given property paths and values.
14
+ * @returns {Record<P, V>} A new object composed of the given property paths and values.
15
15
  *
16
16
  * @example
17
17
  * const paths = ['a.b.c', 'd.e.f'];
@@ -31,8 +31,6 @@
31
31
  * const result = zipObjectDeep(paths, values);
32
32
  * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
33
33
  */
34
- declare function zipObjectDeep<P extends PropertyKey, V>(keys: ArrayLike<P | P[]>, values: ArrayLike<V>): {
35
- [K in P]: V;
36
- };
34
+ declare function zipObjectDeep<P extends PropertyKey, V>(keys: ArrayLike<P | P[]>, values: ArrayLike<V>): Record<P, V>;
37
35
 
38
36
  export { zipObjectDeep };
@@ -35,6 +35,7 @@ export { zipWith } from '../array/zipWith.mjs';
35
35
  export { AbortError } from '../error/AbortError.mjs';
36
36
  export { TimeoutError } from '../error/TimeoutError.mjs';
37
37
  export { after } from '../function/after.mjs';
38
+ export { identity } from '../function/identity.mjs';
38
39
  export { MemoizeCache, memoize } from '../function/memoize.mjs';
39
40
  export { negate } from '../function/negate.mjs';
40
41
  export { noop } from '../function/noop.mjs';
@@ -35,6 +35,7 @@ export { zipWith } from '../array/zipWith.js';
35
35
  export { AbortError } from '../error/AbortError.js';
36
36
  export { TimeoutError } from '../error/TimeoutError.js';
37
37
  export { after } from '../function/after.js';
38
+ export { identity } from '../function/identity.js';
38
39
  export { MemoizeCache, memoize } from '../function/memoize.js';
39
40
  export { negate } from '../function/negate.js';
40
41
  export { noop } from '../function/noop.js';
@@ -4,7 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const zipWith = require('../_chunk/zipWith-Dkv3D1.js');
6
6
  const promise_index = require('../_chunk/index-BGZDR9.js');
7
- const unary = require('../_chunk/unary-CMvKXy.js');
7
+ const unary = require('../_chunk/unary-CcTNuC.js');
8
8
  const noop = require('../_chunk/noop-2IwLUk.js');
9
9
  const sumBy = require('../_chunk/sumBy-RVppiV.js');
10
10
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
@@ -491,10 +491,6 @@ function dropWhileImpl(arr, predicate) {
491
491
  }
492
492
  }
493
493
 
494
- function identity(x) {
495
- return x;
496
- }
497
-
498
494
  function isIterateeCall(value, index, object) {
499
495
  if (!isObject(object)) {
500
496
  return false;
@@ -515,7 +511,7 @@ function every(source, doesMatch, guard) {
515
511
  doesMatch = undefined;
516
512
  }
517
513
  if (!doesMatch) {
518
- doesMatch = identity;
514
+ doesMatch = unary.identity;
519
515
  }
520
516
  switch (typeof doesMatch) {
521
517
  case 'function': {
@@ -579,7 +575,7 @@ function filter(source, predicate) {
579
575
  return [];
580
576
  }
581
577
  if (!predicate) {
582
- predicate = identity;
578
+ predicate = unary.identity;
583
579
  }
584
580
  const collection = isArray(source) ? source : Object.values(source);
585
581
  switch (typeof predicate) {
@@ -840,7 +836,7 @@ function intersectionBy(array, ...values) {
840
836
  return [];
841
837
  }
842
838
  if (isArrayLikeObject(lastValue)) {
843
- result = zipWith.intersectionBy(result, Array.from(value), identity);
839
+ result = zipWith.intersectionBy(result, Array.from(value), unary.identity);
844
840
  }
845
841
  else if (typeof lastValue === 'function') {
846
842
  result = zipWith.intersectionBy(result, Array.from(value), value => lastValue(value));
@@ -1049,7 +1045,7 @@ function some(source, predicate, guard) {
1049
1045
  predicate = undefined;
1050
1046
  }
1051
1047
  if (!predicate) {
1052
- predicate = identity;
1048
+ predicate = unary.identity;
1053
1049
  }
1054
1050
  const values = Array.isArray(source) ? source : Object.values(source);
1055
1051
  switch (typeof predicate) {
@@ -1686,7 +1682,7 @@ function invertBy(object, iteratee) {
1686
1682
  return result;
1687
1683
  }
1688
1684
  if (iteratee == null) {
1689
- iteratee = identity;
1685
+ iteratee = unary.identity;
1690
1686
  }
1691
1687
  const keys = Object.keys(object);
1692
1688
  for (let i = 0; i < keys.length; i++) {
@@ -1704,7 +1700,7 @@ function invertBy(object, iteratee) {
1704
1700
  }
1705
1701
 
1706
1702
  function mapKeys(object, getNewKey) {
1707
- getNewKey = getNewKey ?? identity;
1703
+ getNewKey = getNewKey ?? unary.identity;
1708
1704
  switch (typeof getNewKey) {
1709
1705
  case 'string':
1710
1706
  case 'symbol':
@@ -1719,7 +1715,7 @@ function mapKeys(object, getNewKey) {
1719
1715
  }
1720
1716
 
1721
1717
  function mapValues(object, getNewValue) {
1722
- getNewValue = getNewValue ?? identity;
1718
+ getNewValue = getNewValue ?? unary.identity;
1723
1719
  switch (typeof getNewValue) {
1724
1720
  case 'string':
1725
1721
  case 'symbol':
@@ -2322,6 +2318,7 @@ exports.delay = promise_index.delay;
2322
2318
  exports.timeout = promise_index.timeout;
2323
2319
  exports.withTimeout = promise_index.withTimeout;
2324
2320
  exports.after = unary.after;
2321
+ exports.identity = unary.identity;
2325
2322
  exports.memoize = unary.memoize;
2326
2323
  exports.negate = unary.negate;
2327
2324
  exports.once = unary.once;
@@ -35,6 +35,7 @@ export { zipWith } from '../array/zipWith.mjs';
35
35
  export { AbortError } from '../error/AbortError.mjs';
36
36
  export { TimeoutError } from '../error/TimeoutError.mjs';
37
37
  export { after } from '../function/after.mjs';
38
+ export { identity } from '../function/identity.mjs';
38
39
  export { memoize } from '../function/memoize.mjs';
39
40
  export { negate } from '../function/negate.mjs';
40
41
  export { noop } from '../function/noop.mjs';
@@ -1,5 +1,5 @@
1
+ import { identity } from '../../function/identity.mjs';
1
2
  import { isNil } from '../../predicate/isNil.mjs';
2
- import { identity } from '../_internal/identity.mjs';
3
3
 
4
4
  function invertBy(object, iteratee) {
5
5
  const result = {};
@@ -1,6 +1,6 @@
1
1
  import { property } from './property.mjs';
2
+ import { identity } from '../../function/identity.mjs';
2
3
  import { mapKeys as mapKeys$1 } from '../../object/mapKeys.mjs';
3
- import { identity } from '../_internal/identity.mjs';
4
4
 
5
5
  function mapKeys(object, getNewKey) {
6
6
  getNewKey = getNewKey ?? identity;
@@ -1,6 +1,6 @@
1
1
  import { property } from './property.mjs';
2
+ import { identity } from '../../function/identity.mjs';
2
3
  import { mapValues as mapValues$1 } from '../../object/mapValues.mjs';
3
- import { identity } from '../_internal/identity.mjs';
4
4
 
5
5
  function mapValues(object, getNewValue) {
6
6
  getNewValue = getNewValue ?? identity;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Returns the input value unchanged.
3
+ *
4
+ * @template T - The type of the input value.
5
+ * @param {T} x - The value to be returned.
6
+ * @returns {T} The input value.
7
+ *
8
+ * @example
9
+ * // Returns 5
10
+ * identity(5);
11
+ *
12
+ * @example
13
+ * // Returns 'hello'
14
+ * identity('hello');
15
+ *
16
+ * @example
17
+ * // Returns { key: 'value' }
18
+ * identity({ key: 'value' });
19
+ */
20
+ declare function identity<T>(x: T): T;
21
+
22
+ export { identity };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Returns the input value unchanged.
3
+ *
4
+ * @template T - The type of the input value.
5
+ * @param {T} x - The value to be returned.
6
+ * @returns {T} The input value.
7
+ *
8
+ * @example
9
+ * // Returns 5
10
+ * identity(5);
11
+ *
12
+ * @example
13
+ * // Returns 'hello'
14
+ * identity('hello');
15
+ *
16
+ * @example
17
+ * // Returns { key: 'value' }
18
+ * identity({ key: 'value' });
19
+ */
20
+ declare function identity<T>(x: T): T;
21
+
22
+ export { identity };
@@ -6,6 +6,7 @@ export { curryRight } from './curryRight.mjs';
6
6
  export { debounce } from './debounce.mjs';
7
7
  export { flow } from './flow.mjs';
8
8
  export { flowRight } from './flowRight.mjs';
9
+ export { identity } from './identity.mjs';
9
10
  export { MemoizeCache, memoize } from './memoize.mjs';
10
11
  export { negate } from './negate.mjs';
11
12
  export { noop } from './noop.mjs';
@@ -6,6 +6,7 @@ export { curryRight } from './curryRight.js';
6
6
  export { debounce } from './debounce.js';
7
7
  export { flow } from './flow.js';
8
8
  export { flowRight } from './flowRight.js';
9
+ export { identity } from './identity.js';
9
10
  export { MemoizeCache, memoize } from './memoize.js';
10
11
  export { negate } from './negate.js';
11
12
  export { noop } from './noop.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const unary = require('../_chunk/unary-CMvKXy.js');
5
+ const unary = require('../_chunk/unary-CcTNuC.js');
6
6
  const noop = require('../_chunk/noop-2IwLUk.js');
7
7
 
8
8
  function before(n, func) {
@@ -90,6 +90,7 @@ exports.ary = unary.ary;
90
90
  exports.debounce = unary.debounce;
91
91
  exports.flow = unary.flow;
92
92
  exports.flowRight = unary.flowRight;
93
+ exports.identity = unary.identity;
93
94
  exports.memoize = unary.memoize;
94
95
  exports.negate = unary.negate;
95
96
  exports.once = unary.once;
@@ -6,6 +6,7 @@ export { curryRight } from './curryRight.mjs';
6
6
  export { debounce } from './debounce.mjs';
7
7
  export { flow } from './flow.mjs';
8
8
  export { flowRight } from './flowRight.mjs';
9
+ export { identity } from './identity.mjs';
9
10
  export { memoize } from './memoize.mjs';
10
11
  export { negate } from './negate.mjs';
11
12
  export { noop } from './noop.mjs';
package/dist/index.d.mts CHANGED
@@ -64,6 +64,7 @@ export { curryRight } from './function/curryRight.mjs';
64
64
  export { debounce } from './function/debounce.mjs';
65
65
  export { flow } from './function/flow.mjs';
66
66
  export { flowRight } from './function/flowRight.mjs';
67
+ export { identity } from './function/identity.mjs';
67
68
  export { MemoizeCache, memoize } from './function/memoize.mjs';
68
69
  export { negate } from './function/negate.mjs';
69
70
  export { noop } from './function/noop.mjs';
package/dist/index.d.ts CHANGED
@@ -64,6 +64,7 @@ export { curryRight } from './function/curryRight.js';
64
64
  export { debounce } from './function/debounce.js';
65
65
  export { flow } from './function/flow.js';
66
66
  export { flowRight } from './function/flowRight.js';
67
+ export { identity } from './function/identity.js';
67
68
  export { MemoizeCache, memoize } from './function/memoize.js';
68
69
  export { negate } from './function/negate.js';
69
70
  export { noop } from './function/noop.js';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
  const zipWith = require('./_chunk/zipWith-Dkv3D1.js');
6
6
  const array_index = require('./array/index.js');
7
7
  const promise_index = require('./_chunk/index-BGZDR9.js');
8
- const unary = require('./_chunk/unary-CMvKXy.js');
8
+ const unary = require('./_chunk/unary-CcTNuC.js');
9
9
  const function_index = require('./function/index.js');
10
10
  const noop = require('./_chunk/noop-2IwLUk.js');
11
11
  const sumBy = require('./_chunk/sumBy-RVppiV.js');
@@ -87,6 +87,7 @@ exports.ary = unary.ary;
87
87
  exports.debounce = unary.debounce;
88
88
  exports.flow = unary.flow;
89
89
  exports.flowRight = unary.flowRight;
90
+ exports.identity = unary.identity;
90
91
  exports.memoize = unary.memoize;
91
92
  exports.negate = unary.negate;
92
93
  exports.once = unary.once;
package/dist/index.mjs CHANGED
@@ -64,6 +64,7 @@ export { curryRight } from './function/curryRight.mjs';
64
64
  export { debounce } from './function/debounce.mjs';
65
65
  export { flow } from './function/flow.mjs';
66
66
  export { flowRight } from './function/flowRight.mjs';
67
+ export { identity } from './function/identity.mjs';
67
68
  export { memoize } from './function/memoize.mjs';
68
69
  export { negate } from './function/negate.mjs';
69
70
  export { noop } from './function/noop.mjs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.25.2-dev.819+415d325f",
4
+ "version": "1.25.2-dev.821+bd7468fc",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {