es-toolkit 1.17.0-dev.515 → 1.17.0-dev.516

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.
@@ -140,6 +140,7 @@ export { isRegExp } from './predicate/isRegExp.mjs';
140
140
  export { isString } from './predicate/isString.mjs';
141
141
  export { matches } from './predicate/matches.mjs';
142
142
  export { matchesProperty } from './predicate/matchesProperty.mjs';
143
+ export { isWeakMap } from './predicate/isWeakMap.mjs';
143
144
  export { startsWith } from './string/startsWith.mjs';
144
145
  export { endsWith } from './string/endsWith.mjs';
145
146
  export { padStart } from './string/padStart.mjs';
@@ -140,6 +140,7 @@ export { isRegExp } from './predicate/isRegExp.js';
140
140
  export { isString } from './predicate/isString.js';
141
141
  export { matches } from './predicate/matches.js';
142
142
  export { matchesProperty } from './predicate/matchesProperty.js';
143
+ export { isWeakMap } from './predicate/isWeakMap.js';
143
144
  export { startsWith } from './string/startsWith.js';
144
145
  export { endsWith } from './string/endsWith.js';
145
146
  export { padStart } from './string/padStart.js';
@@ -8,7 +8,7 @@ const rest$1 = require('../_chunk/rest-Bzm2XK.js');
8
8
  const math_index = require('../math/index.js');
9
9
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
10
10
  const toMerged = require('../_chunk/toMerged-BGwYW5.js');
11
- const isFunction = require('../_chunk/isFunction-aCEz9d.js');
11
+ const isWeakMap$1 = require('../_chunk/isWeakMap-DxR6ns.js');
12
12
  const isTypedArray$1 = require('../_chunk/isTypedArray-BBEkFl.js');
13
13
  const string_index = require('../string/index.js');
14
14
 
@@ -250,14 +250,14 @@ function cloneDeep(obj) {
250
250
  return toMerged.cloneDeep(obj);
251
251
  }
252
252
  switch (Object.prototype.toString.call(obj)) {
253
- case isFunction.numberTag:
254
- case isFunction.stringTag:
255
- case isFunction.booleanTag: {
253
+ case isWeakMap$1.numberTag:
254
+ case isWeakMap$1.stringTag:
255
+ case isWeakMap$1.booleanTag: {
256
256
  const result = new obj.constructor(obj?.valueOf());
257
257
  toMerged.copyProperties(result, obj);
258
258
  return result;
259
259
  }
260
- case isFunction.argumentsTag: {
260
+ case isWeakMap$1.argumentsTag: {
261
261
  const result = {};
262
262
  toMerged.copyProperties(result, obj);
263
263
  result.length = obj.length;
@@ -286,7 +286,7 @@ function isIndex(value) {
286
286
  }
287
287
 
288
288
  function isArguments(value) {
289
- return value !== null && typeof value === 'object' && isFunction.getTag(value) === '[object Arguments]';
289
+ return value !== null && typeof value === 'object' && isWeakMap$1.getTag(value) === '[object Arguments]';
290
290
  }
291
291
 
292
292
  function has(object, path) {
@@ -511,7 +511,7 @@ function orderBy(collection, criteria, orders) {
511
511
  }
512
512
 
513
513
  function size(target) {
514
- if (isFunction.isNil(target)) {
514
+ if (isWeakMap$1.isNil(target)) {
515
515
  return 0;
516
516
  }
517
517
  if (target instanceof Map || target instanceof Set) {
@@ -765,33 +765,37 @@ function isArray(value) {
765
765
  }
766
766
 
767
767
  function isArrayLike(value) {
768
- return value != null && typeof value !== 'function' && isFunction.isLength(value.length);
768
+ return value != null && typeof value !== 'function' && isWeakMap$1.isLength(value.length);
769
769
  }
770
770
 
771
771
  function isBoolean(x) {
772
772
  if (x === true || x === false) {
773
773
  return true;
774
774
  }
775
- if (typeof x === 'object' && x != null && isFunction.getTag(x) === '[object Boolean]') {
775
+ if (typeof x === 'object' && x != null && isWeakMap$1.getTag(x) === '[object Boolean]') {
776
776
  return true;
777
777
  }
778
778
  return false;
779
779
  }
780
780
 
781
781
  function isRegExp(value) {
782
- return isFunction.getTag(value) === '[object RegExp]';
782
+ return isWeakMap$1.getTag(value) === '[object RegExp]';
783
783
  }
784
784
 
785
785
  function isString(value) {
786
786
  if (typeof value === 'string') {
787
787
  return true;
788
788
  }
789
- if (typeof value === 'object' && value != null && isFunction.getTag(value) === '[object String]') {
789
+ if (typeof value === 'object' && value != null && isWeakMap$1.getTag(value) === '[object String]') {
790
790
  return true;
791
791
  }
792
792
  return false;
793
793
  }
794
794
 
795
+ function isWeakMap(value) {
796
+ return isWeakMap$1.isWeakMap(value);
797
+ }
798
+
795
799
  const startsWith = (str, target, position = 0) => {
796
800
  return str.startsWith(target, position);
797
801
  };
@@ -919,13 +923,13 @@ exports.omitBy = toMerged.omitBy;
919
923
  exports.pick = toMerged.pick;
920
924
  exports.pickBy = toMerged.pickBy;
921
925
  exports.toMerged = toMerged.toMerged;
922
- exports.isEqual = isFunction.isEqual;
923
- exports.isFunction = isFunction.isFunction;
924
- exports.isLength = isFunction.isLength;
925
- exports.isNil = isFunction.isNil;
926
- exports.isNotNil = isFunction.isNotNil;
927
- exports.isNull = isFunction.isNull;
928
- exports.isUndefined = isFunction.isUndefined;
926
+ exports.isEqual = isWeakMap$1.isEqual;
927
+ exports.isFunction = isWeakMap$1.isFunction;
928
+ exports.isLength = isWeakMap$1.isLength;
929
+ exports.isNil = isWeakMap$1.isNil;
930
+ exports.isNotNil = isWeakMap$1.isNotNil;
931
+ exports.isNull = isWeakMap$1.isNull;
932
+ exports.isUndefined = isWeakMap$1.isUndefined;
929
933
  exports.isPrimitive = isTypedArray$1.isPrimitive;
930
934
  exports.camelCase = string_index.camelCase;
931
935
  exports.capitalize = string_index.capitalize;
@@ -963,6 +967,7 @@ exports.isRegExp = isRegExp;
963
967
  exports.isString = isString;
964
968
  exports.isSymbol = isSymbol;
965
969
  exports.isTypedArray = isTypedArray;
970
+ exports.isWeakMap = isWeakMap;
966
971
  exports.mapKeys = mapKeys;
967
972
  exports.mapValues = mapValues;
968
973
  exports.matches = matches;
@@ -140,6 +140,7 @@ export { isRegExp } from './predicate/isRegExp.mjs';
140
140
  export { isString } from './predicate/isString.mjs';
141
141
  export { matches } from './predicate/matches.mjs';
142
142
  export { matchesProperty } from './predicate/matchesProperty.mjs';
143
+ export { isWeakMap } from './predicate/isWeakMap.mjs';
143
144
  export { startsWith } from './string/startsWith.mjs';
144
145
  export { endsWith } from './string/endsWith.mjs';
145
146
  export { padStart } from './string/padStart.mjs';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Checks if the given value is a `WeakMap`.
3
+ *
4
+ * This function tests whether the provided value is an instance of `WeakMap`.
5
+ * It returns `true` if the value is a `WeakMap`, and `false` otherwise.
6
+ *
7
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`.
8
+ *
9
+ * @param {unknown} value - The value to test if it is a `WeakMap`.
10
+ * @returns {value is WeakMap<WeakKey, any>} true if the value is a `WeakMap`, false otherwise.
11
+ *
12
+ * @example
13
+ * const value1 = new WeakMap();
14
+ * const value2 = new Map();
15
+ * const value3 = new Set();
16
+ *
17
+ * console.log(isWeakMap(value1)); // true
18
+ * console.log(isWeakMap(value2)); // false
19
+ * console.log(isWeakMap(value3)); // false
20
+ */
21
+ declare function isWeakMap(value?: unknown): value is WeakMap<WeakKey, any>;
22
+
23
+ export { isWeakMap };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Checks if the given value is a `WeakMap`.
3
+ *
4
+ * This function tests whether the provided value is an instance of `WeakMap`.
5
+ * It returns `true` if the value is a `WeakMap`, and `false` otherwise.
6
+ *
7
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`.
8
+ *
9
+ * @param {unknown} value - The value to test if it is a `WeakMap`.
10
+ * @returns {value is WeakMap<WeakKey, any>} true if the value is a `WeakMap`, false otherwise.
11
+ *
12
+ * @example
13
+ * const value1 = new WeakMap();
14
+ * const value2 = new Map();
15
+ * const value3 = new Set();
16
+ *
17
+ * console.log(isWeakMap(value1)); // true
18
+ * console.log(isWeakMap(value2)); // false
19
+ * console.log(isWeakMap(value3)); // false
20
+ */
21
+ declare function isWeakMap(value?: unknown): value is WeakMap<WeakKey, any>;
22
+
23
+ export { isWeakMap };
@@ -0,0 +1,7 @@
1
+ import { isWeakMap as isWeakMap$1 } from '../../predicate/isWeakMap.mjs';
2
+
3
+ function isWeakMap(value) {
4
+ return isWeakMap$1(value);
5
+ }
6
+
7
+ export { isWeakMap };
package/dist/index.d.mts CHANGED
@@ -107,6 +107,7 @@ export { isRegExp } from './predicate/isRegExp.mjs';
107
107
  export { isBoolean } from './predicate/isBoolean.mjs';
108
108
  export { isSymbol } from './predicate/isSymbol.mjs';
109
109
  export { isString } from './predicate/isString.mjs';
110
+ export { isWeakMap } from './predicate/isWeakMap.mjs';
110
111
  export { delay } from './promise/delay.mjs';
111
112
  export { withTimeout } from './promise/withTimeout.mjs';
112
113
  export { timeout } from './promise/timeout.mjs';
package/dist/index.d.ts CHANGED
@@ -107,6 +107,7 @@ export { isRegExp } from './predicate/isRegExp.js';
107
107
  export { isBoolean } from './predicate/isBoolean.js';
108
108
  export { isSymbol } from './predicate/isSymbol.js';
109
109
  export { isString } from './predicate/isString.js';
110
+ export { isWeakMap } from './predicate/isWeakMap.js';
110
111
  export { delay } from './promise/delay.js';
111
112
  export { withTimeout } from './promise/withTimeout.js';
112
113
  export { timeout } from './promise/timeout.js';
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ const math_index = require('./math/index.js');
11
11
  const randomInt = require('./_chunk/randomInt-CF7bZK.js');
12
12
  const toMerged = require('./_chunk/toMerged-BGwYW5.js');
13
13
  const object_index = require('./object/index.js');
14
- const isFunction = require('./_chunk/isFunction-aCEz9d.js');
14
+ const isWeakMap = require('./_chunk/isWeakMap-DxR6ns.js');
15
15
  const isTypedArray = require('./_chunk/isTypedArray-BBEkFl.js');
16
16
  const predicate_index = require('./predicate/index.js');
17
17
  const string_index = require('./string/index.js');
@@ -116,13 +116,14 @@ exports.pick = toMerged.pick;
116
116
  exports.pickBy = toMerged.pickBy;
117
117
  exports.toMerged = toMerged.toMerged;
118
118
  exports.mergeWith = object_index.mergeWith;
119
- exports.isEqual = isFunction.isEqual;
120
- exports.isFunction = isFunction.isFunction;
121
- exports.isLength = isFunction.isLength;
122
- exports.isNil = isFunction.isNil;
123
- exports.isNotNil = isFunction.isNotNil;
124
- exports.isNull = isFunction.isNull;
125
- exports.isUndefined = isFunction.isUndefined;
119
+ exports.isEqual = isWeakMap.isEqual;
120
+ exports.isFunction = isWeakMap.isFunction;
121
+ exports.isLength = isWeakMap.isLength;
122
+ exports.isNil = isWeakMap.isNil;
123
+ exports.isNotNil = isWeakMap.isNotNil;
124
+ exports.isNull = isWeakMap.isNull;
125
+ exports.isUndefined = isWeakMap.isUndefined;
126
+ exports.isWeakMap = isWeakMap.isWeakMap;
126
127
  exports.isPlainObject = isTypedArray.isPlainObject;
127
128
  exports.isPrimitive = isTypedArray.isPrimitive;
128
129
  exports.isTypedArray = isTypedArray.isTypedArray;
package/dist/index.mjs CHANGED
@@ -107,6 +107,7 @@ export { isRegExp } from './predicate/isRegExp.mjs';
107
107
  export { isBoolean } from './predicate/isBoolean.mjs';
108
108
  export { isSymbol } from './predicate/isSymbol.mjs';
109
109
  export { isString } from './predicate/isString.mjs';
110
+ export { isWeakMap } from './predicate/isWeakMap.mjs';
110
111
  export { delay } from './promise/delay.mjs';
111
112
  export { withTimeout } from './promise/withTimeout.mjs';
112
113
  export { timeout } from './promise/timeout.mjs';
@@ -12,3 +12,4 @@ export { isRegExp } from './isRegExp.mjs';
12
12
  export { isBoolean } from './isBoolean.mjs';
13
13
  export { isSymbol } from './isSymbol.mjs';
14
14
  export { isString } from './isString.mjs';
15
+ export { isWeakMap } from './isWeakMap.mjs';
@@ -12,3 +12,4 @@ export { isRegExp } from './isRegExp.js';
12
12
  export { isBoolean } from './isBoolean.js';
13
13
  export { isSymbol } from './isSymbol.js';
14
14
  export { isString } from './isString.js';
15
+ export { isWeakMap } from './isWeakMap.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const isFunction = require('../_chunk/isFunction-aCEz9d.js');
5
+ const isWeakMap = require('../_chunk/isWeakMap-DxR6ns.js');
6
6
  const isTypedArray = require('../_chunk/isTypedArray-BBEkFl.js');
7
7
 
8
8
  function isRegExp(value) {
@@ -21,13 +21,14 @@ function isString(value) {
21
21
  return typeof value === 'string';
22
22
  }
23
23
 
24
- exports.isEqual = isFunction.isEqual;
25
- exports.isFunction = isFunction.isFunction;
26
- exports.isLength = isFunction.isLength;
27
- exports.isNil = isFunction.isNil;
28
- exports.isNotNil = isFunction.isNotNil;
29
- exports.isNull = isFunction.isNull;
30
- exports.isUndefined = isFunction.isUndefined;
24
+ exports.isEqual = isWeakMap.isEqual;
25
+ exports.isFunction = isWeakMap.isFunction;
26
+ exports.isLength = isWeakMap.isLength;
27
+ exports.isNil = isWeakMap.isNil;
28
+ exports.isNotNil = isWeakMap.isNotNil;
29
+ exports.isNull = isWeakMap.isNull;
30
+ exports.isUndefined = isWeakMap.isUndefined;
31
+ exports.isWeakMap = isWeakMap.isWeakMap;
31
32
  exports.isPlainObject = isTypedArray.isPlainObject;
32
33
  exports.isPrimitive = isTypedArray.isPrimitive;
33
34
  exports.isTypedArray = isTypedArray.isTypedArray;
@@ -12,3 +12,4 @@ export { isRegExp } from './isRegExp.mjs';
12
12
  export { isBoolean } from './isBoolean.mjs';
13
13
  export { isSymbol } from './isSymbol.mjs';
14
14
  export { isString } from './isString.mjs';
15
+ export { isWeakMap } from './isWeakMap.mjs';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Checks if the given value is a `WeakMap`.
3
+ *
4
+ * This function tests whether the provided value is an instance of `WeakMap`.
5
+ * It returns `true` if the value is a `WeakMap`, and `false` otherwise.
6
+ *
7
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`.
8
+ *
9
+ * @param {unknown} value - The value to test if it is a `WeakMap`.
10
+ * @returns {value is WeakMap<WeakKey, any>} true if the value is a `WeakMap`, false otherwise.
11
+ *
12
+ * @example
13
+ * const value1 = new WeakMap();
14
+ * const value2 = new Map();
15
+ * const value3 = new Set();
16
+ *
17
+ * console.log(isWeakMap(value1)); // true
18
+ * console.log(isWeakMap(value2)); // false
19
+ * console.log(isWeakMap(value3)); // false
20
+ */
21
+ declare function isWeakMap(value: unknown): value is WeakMap<WeakKey, any>;
22
+
23
+ export { isWeakMap };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Checks if the given value is a `WeakMap`.
3
+ *
4
+ * This function tests whether the provided value is an instance of `WeakMap`.
5
+ * It returns `true` if the value is a `WeakMap`, and `false` otherwise.
6
+ *
7
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`.
8
+ *
9
+ * @param {unknown} value - The value to test if it is a `WeakMap`.
10
+ * @returns {value is WeakMap<WeakKey, any>} true if the value is a `WeakMap`, false otherwise.
11
+ *
12
+ * @example
13
+ * const value1 = new WeakMap();
14
+ * const value2 = new Map();
15
+ * const value3 = new Set();
16
+ *
17
+ * console.log(isWeakMap(value1)); // true
18
+ * console.log(isWeakMap(value2)); // false
19
+ * console.log(isWeakMap(value3)); // false
20
+ */
21
+ declare function isWeakMap(value: unknown): value is WeakMap<WeakKey, any>;
22
+
23
+ export { isWeakMap };
@@ -0,0 +1,5 @@
1
+ function isWeakMap(value) {
2
+ return value instanceof WeakMap;
3
+ }
4
+
5
+ export { isWeakMap };
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.17.0-dev.515+959b5d08",
4
+ "version": "1.17.0-dev.516+158435c1",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {