ut2 1.4.9 → 1.5.0
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/README.md +4 -4
- package/dist/ut2.js +52 -53
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/internals/getSymbols.js +2 -2
- package/es/internals/getTag.js +8 -8
- package/es/internals/getTagWithBugfix.js +6 -6
- package/es/internals/helpers.js +4 -4
- package/es/internals/keys.js +2 -2
- package/es/internals/native.js +9 -8
- package/es/internals/nodeUtil.js +0 -5
- package/es/internals/root.js +2 -1
- package/es/isArguments.js +3 -3
- package/es/isArrayBuffer.js +2 -2
- package/es/isBlob.js +2 -2
- package/es/isBoolean.js +2 -2
- package/es/isDate.js +2 -2
- package/es/isEqual.js +3 -3
- package/es/isError.js +2 -2
- package/es/isFunction.js +2 -2
- package/es/isMatch.js +2 -2
- package/es/isNumber.js +2 -2
- package/es/isPlainObject.js +4 -4
- package/es/isRegExp.js +2 -2
- package/es/isString.js +2 -2
- package/es/isSymbol.js +2 -2
- package/es/isTypedArray.js +2 -2
- package/es/isWeakSet.js +2 -2
- package/es/nth.js +3 -3
- package/lib/internals/getSymbols.js +1 -1
- package/lib/internals/getTag.js +7 -7
- package/lib/internals/getTagWithBugfix.js +5 -5
- package/lib/internals/helpers.js +3 -3
- package/lib/internals/keys.js +1 -1
- package/lib/internals/native.js +8 -7
- package/lib/internals/nodeUtil.js +0 -5
- package/lib/internals/root.js +2 -1
- package/lib/isArguments.js +2 -2
- package/lib/isArrayBuffer.js +1 -1
- package/lib/isBlob.js +1 -1
- package/lib/isBoolean.js +1 -1
- package/lib/isDate.js +1 -1
- package/lib/isEqual.js +2 -2
- package/lib/isError.js +1 -1
- package/lib/isFunction.js +1 -1
- package/lib/isMatch.js +1 -1
- package/lib/isNumber.js +1 -1
- package/lib/isPlainObject.js +3 -3
- package/lib/isRegExp.js +1 -1
- package/lib/isString.js +1 -1
- package/lib/isSymbol.js +1 -1
- package/lib/isTypedArray.js +1 -1
- package/lib/isWeakSet.js +1 -1
- package/lib/nth.js +2 -2
- package/package.json +8 -7
- package/types/internals/native.d.ts +8 -7
package/lib/isEqual.js
CHANGED
|
@@ -27,7 +27,7 @@ function setToArray(set) {
|
|
|
27
27
|
return orderBy(result);
|
|
28
28
|
}
|
|
29
29
|
function argToArray(arg) {
|
|
30
|
-
return native.
|
|
30
|
+
return native.arrayProtoSlice.call(arg);
|
|
31
31
|
}
|
|
32
32
|
function toBufferView(bufferSource) {
|
|
33
33
|
return new Uint8Array(bufferSource.buffer || bufferSource, bufferSource.byteOffset || 0, bufferSource.byteLength);
|
|
@@ -154,7 +154,7 @@ function isEqualDeep(value, other, customizer, strictCheck, valueStack, otherSta
|
|
|
154
154
|
continue;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
if (!(native.
|
|
157
|
+
if (!(native.objectProtoHasOwnProperty.call(other, key) && isEqualDeep(value[key], other[key], customizer, strictCheck, valueStack, otherStack))) {
|
|
158
158
|
return false;
|
|
159
159
|
}
|
|
160
160
|
if (!skipCtor && key === 'constructor') {
|
package/lib/isError.js
CHANGED
package/lib/isFunction.js
CHANGED
|
@@ -6,7 +6,7 @@ function isFunction(value) {
|
|
|
6
6
|
if (typeof value === 'function') {
|
|
7
7
|
return true;
|
|
8
8
|
}
|
|
9
|
-
var tag = native.
|
|
9
|
+
var tag = native.objectProtoToString.call(value);
|
|
10
10
|
return native.functionTags.some(function (item) { return item === tag; });
|
|
11
11
|
}
|
|
12
12
|
|
package/lib/isMatch.js
CHANGED
|
@@ -5,7 +5,7 @@ var native = require('./internals/native.js');
|
|
|
5
5
|
var isEqual = require('./isEqual.js');
|
|
6
6
|
|
|
7
7
|
function isDeepComparable(object, source) {
|
|
8
|
-
return native.
|
|
8
|
+
return native.objectProtoToString.call(object) === native.objectTag && native.objectProtoToString.call(source) === native.objectTag;
|
|
9
9
|
}
|
|
10
10
|
function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack, executedCustomizer) {
|
|
11
11
|
if (executedCustomizer === void 0) { executedCustomizer = false; }
|
package/lib/isNumber.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var native = require('./internals/native.js');
|
|
4
4
|
|
|
5
5
|
function isNumber(value) {
|
|
6
|
-
return typeof value === 'number' || native.
|
|
6
|
+
return typeof value === 'number' || native.objectProtoToString.call(value) === native.numberTag;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
module.exports = isNumber;
|
package/lib/isPlainObject.js
CHANGED
|
@@ -4,7 +4,7 @@ var getTag = require('./internals/getTag.js');
|
|
|
4
4
|
var native = require('./internals/native.js');
|
|
5
5
|
var isObjectLike = require('./isObjectLike.js');
|
|
6
6
|
|
|
7
|
-
var objectCtorString = native.
|
|
7
|
+
var objectCtorString = native.functionProtoToString.call(Object);
|
|
8
8
|
function isPlainObject(value) {
|
|
9
9
|
if (!isObjectLike(value) || getTag(value) !== native.objectTag) {
|
|
10
10
|
return false;
|
|
@@ -13,8 +13,8 @@ function isPlainObject(value) {
|
|
|
13
13
|
if (proto === null) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
var Ctor = native.
|
|
17
|
-
return typeof Ctor === 'function' && Ctor instanceof Ctor && native.
|
|
16
|
+
var Ctor = native.objectProtoHasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
17
|
+
return typeof Ctor === 'function' && Ctor instanceof Ctor && native.functionProtoToString.call(Ctor) === objectCtorString;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
module.exports = isPlainObject;
|
package/lib/isRegExp.js
CHANGED
|
@@ -4,7 +4,7 @@ var native = require('./internals/native.js');
|
|
|
4
4
|
var nodeUtil = require('./internals/nodeUtil.js');
|
|
5
5
|
|
|
6
6
|
function isRegExp(value) {
|
|
7
|
-
return nodeUtil.nodeIsRegExp ? nodeUtil.nodeIsRegExp(value) : native.
|
|
7
|
+
return nodeUtil.nodeIsRegExp ? nodeUtil.nodeIsRegExp(value) : native.objectProtoToString.call(value) === native.regExpTag;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
module.exports = isRegExp;
|
package/lib/isString.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var native = require('./internals/native.js');
|
|
4
4
|
|
|
5
5
|
function isString(value) {
|
|
6
|
-
return typeof value === 'string' || native.
|
|
6
|
+
return typeof value === 'string' || native.objectProtoToString.call(value) === native.stringTag;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
module.exports = isString;
|
package/lib/isSymbol.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var native = require('./internals/native.js');
|
|
4
4
|
|
|
5
5
|
function isSymbol(value) {
|
|
6
|
-
return typeof value === 'symbol' || native.
|
|
6
|
+
return typeof value === 'symbol' || native.objectProtoToString.call(value) === native.symbolTag;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
module.exports = isSymbol;
|
package/lib/isTypedArray.js
CHANGED
|
@@ -10,7 +10,7 @@ function isTypedArray(value) {
|
|
|
10
10
|
return nodeUtil.nodeIsTypedArray(value);
|
|
11
11
|
}
|
|
12
12
|
if (isObjectLike(value) && isLength(value.length)) {
|
|
13
|
-
var tag_1 = native.
|
|
13
|
+
var tag_1 = native.objectProtoToString.call(value);
|
|
14
14
|
return native.typedArrayTags.some(function (item) { return item === tag_1; });
|
|
15
15
|
}
|
|
16
16
|
return false;
|
package/lib/isWeakSet.js
CHANGED
package/lib/nth.js
CHANGED
|
@@ -8,8 +8,8 @@ function nth(array, n) {
|
|
|
8
8
|
if (!isArrayLike(array)) {
|
|
9
9
|
return undefined;
|
|
10
10
|
}
|
|
11
|
-
if (typeof native.
|
|
12
|
-
return native.
|
|
11
|
+
if (typeof native.arrayProtoAt === 'function') {
|
|
12
|
+
return native.arrayProtoAt.call(array, n);
|
|
13
13
|
}
|
|
14
14
|
var index = n < 0 ? n + array.length : n;
|
|
15
15
|
return array[index];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ut2",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"author": "caijf",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"prettier": "prettier --write **/*",
|
|
25
25
|
"commit": "cz",
|
|
26
26
|
"prepublishOnly": "npm test && npm run build",
|
|
27
|
-
"tsc": "tsc --noEmit"
|
|
27
|
+
"tsc": "tsc --noEmit",
|
|
28
|
+
"prepare": "husky install"
|
|
28
29
|
},
|
|
29
30
|
"repository": {
|
|
30
31
|
"type": "git",
|
|
@@ -55,10 +56,6 @@
|
|
|
55
56
|
"path": "./node_modules/cz-conventional-changelog"
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
|
-
"gitHooks": {
|
|
59
|
-
"pre-commit": "lint-staged",
|
|
60
|
-
"commit-msg": "npx --no -- commitlint --edit \"$1\""
|
|
61
|
-
},
|
|
62
59
|
"publishConfig": {
|
|
63
60
|
"registry": "https://registry.npmjs.org/"
|
|
64
61
|
},
|
|
@@ -71,6 +68,7 @@
|
|
|
71
68
|
"@rollup/plugin-terser": "^0.4.3",
|
|
72
69
|
"@rollup/plugin-typescript": "^11.1.3",
|
|
73
70
|
"@types/jest": "^29.5.4",
|
|
71
|
+
"@types/node": "^20.6.2",
|
|
74
72
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
75
73
|
"@typescript-eslint/parser": "^5.62.0",
|
|
76
74
|
"cross-env": "^7.0.3",
|
|
@@ -86,6 +84,9 @@
|
|
|
86
84
|
"ts-jest": "^29.1.1",
|
|
87
85
|
"tslib": "^2.6.2",
|
|
88
86
|
"typescript": "^5.2.2",
|
|
89
|
-
"
|
|
87
|
+
"husky": "^8.0.0"
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=14"
|
|
90
91
|
}
|
|
91
92
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export declare const objectProto: Object;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const objectProtoToString: () => string;
|
|
3
|
+
export declare const objectProtoHasOwnProperty: (v: PropertyKey) => boolean;
|
|
4
|
+
export declare const objectProtoPropertyIsEnumerable: (v: PropertyKey) => boolean;
|
|
3
5
|
export declare const objectGetOwnPropertySymbols: (o: any) => symbol[];
|
|
4
6
|
export declare const objectGetPrototypeOf: (o: any) => any;
|
|
5
7
|
export declare const objectKeys: {
|
|
6
8
|
(o: object): string[];
|
|
7
9
|
(o: {}): string[];
|
|
8
10
|
};
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const functionToString: () => string;
|
|
11
|
+
export declare const functionProto: Function;
|
|
12
|
+
export declare const functionProtoToString: () => string;
|
|
12
13
|
export declare const symbolProto: Symbol | undefined;
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const symbolToStringTag: typeof Symbol.toStringTag | undefined;
|
|
14
15
|
export declare const arrayProto: any[];
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const arrayProtoSlice: (start?: number | undefined, end?: number | undefined) => any[];
|
|
17
|
+
export declare const arrayProtoAt: (index: number) => any;
|
|
17
18
|
export declare const numberIsFinite: (number: unknown) => boolean;
|
|
18
19
|
export declare const numberIsInteger: (number: unknown) => boolean;
|
|
19
20
|
export declare const numberIsSafeInteger: (number: unknown) => boolean;
|