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.
- package/dist/_chunk/{isFunction-aCEz9d.js → isWeakMap-DxR6ns.js} +5 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +23 -18
- package/dist/compat/index.mjs +1 -0
- package/dist/compat/predicate/isWeakMap.d.mts +23 -0
- package/dist/compat/predicate/isWeakMap.d.ts +23 -0
- package/dist/compat/predicate/isWeakMap.mjs +7 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -8
- package/dist/index.mjs +1 -0
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +9 -8
- package/dist/predicate/index.mjs +1 -0
- package/dist/predicate/isWeakMap.d.mts +23 -0
- package/dist/predicate/isWeakMap.d.ts +23 -0
- package/dist/predicate/isWeakMap.mjs +5 -0
- package/package.json +1 -1
package/dist/compat/index.d.mts
CHANGED
|
@@ -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';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/compat/index.js
CHANGED
|
@@ -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
|
|
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
|
|
254
|
-
case
|
|
255
|
-
case
|
|
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
|
|
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' &&
|
|
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 (
|
|
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' &&
|
|
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 &&
|
|
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
|
|
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 &&
|
|
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 =
|
|
923
|
-
exports.isFunction =
|
|
924
|
-
exports.isLength =
|
|
925
|
-
exports.isNil =
|
|
926
|
-
exports.isNotNil =
|
|
927
|
-
exports.isNull =
|
|
928
|
-
exports.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;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -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 };
|
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
|
|
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 =
|
|
120
|
-
exports.isFunction =
|
|
121
|
-
exports.isLength =
|
|
122
|
-
exports.isNil =
|
|
123
|
-
exports.isNotNil =
|
|
124
|
-
exports.isNull =
|
|
125
|
-
exports.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';
|
package/dist/predicate/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
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 =
|
|
25
|
-
exports.isFunction =
|
|
26
|
-
exports.isLength =
|
|
27
|
-
exports.isNil =
|
|
28
|
-
exports.isNotNil =
|
|
29
|
-
exports.isNull =
|
|
30
|
-
exports.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;
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -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 };
|
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.
|
|
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": {
|