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.
Files changed (57) hide show
  1. package/README.md +4 -4
  2. package/dist/ut2.js +52 -53
  3. package/dist/ut2.js.map +1 -1
  4. package/dist/ut2.min.js +1 -1
  5. package/dist/ut2.min.js.map +1 -1
  6. package/es/internals/getSymbols.js +2 -2
  7. package/es/internals/getTag.js +8 -8
  8. package/es/internals/getTagWithBugfix.js +6 -6
  9. package/es/internals/helpers.js +4 -4
  10. package/es/internals/keys.js +2 -2
  11. package/es/internals/native.js +9 -8
  12. package/es/internals/nodeUtil.js +0 -5
  13. package/es/internals/root.js +2 -1
  14. package/es/isArguments.js +3 -3
  15. package/es/isArrayBuffer.js +2 -2
  16. package/es/isBlob.js +2 -2
  17. package/es/isBoolean.js +2 -2
  18. package/es/isDate.js +2 -2
  19. package/es/isEqual.js +3 -3
  20. package/es/isError.js +2 -2
  21. package/es/isFunction.js +2 -2
  22. package/es/isMatch.js +2 -2
  23. package/es/isNumber.js +2 -2
  24. package/es/isPlainObject.js +4 -4
  25. package/es/isRegExp.js +2 -2
  26. package/es/isString.js +2 -2
  27. package/es/isSymbol.js +2 -2
  28. package/es/isTypedArray.js +2 -2
  29. package/es/isWeakSet.js +2 -2
  30. package/es/nth.js +3 -3
  31. package/lib/internals/getSymbols.js +1 -1
  32. package/lib/internals/getTag.js +7 -7
  33. package/lib/internals/getTagWithBugfix.js +5 -5
  34. package/lib/internals/helpers.js +3 -3
  35. package/lib/internals/keys.js +1 -1
  36. package/lib/internals/native.js +8 -7
  37. package/lib/internals/nodeUtil.js +0 -5
  38. package/lib/internals/root.js +2 -1
  39. package/lib/isArguments.js +2 -2
  40. package/lib/isArrayBuffer.js +1 -1
  41. package/lib/isBlob.js +1 -1
  42. package/lib/isBoolean.js +1 -1
  43. package/lib/isDate.js +1 -1
  44. package/lib/isEqual.js +2 -2
  45. package/lib/isError.js +1 -1
  46. package/lib/isFunction.js +1 -1
  47. package/lib/isMatch.js +1 -1
  48. package/lib/isNumber.js +1 -1
  49. package/lib/isPlainObject.js +3 -3
  50. package/lib/isRegExp.js +1 -1
  51. package/lib/isString.js +1 -1
  52. package/lib/isSymbol.js +1 -1
  53. package/lib/isTypedArray.js +1 -1
  54. package/lib/isWeakSet.js +1 -1
  55. package/lib/nth.js +2 -2
  56. package/package.json +8 -7
  57. 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.arrSlice.call(arg);
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.hasOwnProperty.call(other, key) && isEqualDeep(value[key], other[key], customizer, strictCheck, valueStack, otherStack))) {
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
@@ -10,7 +10,7 @@ function isError(value) {
10
10
  if (value instanceof Error) {
11
11
  return true;
12
12
  }
13
- var tag = native.objectToString.call(value);
13
+ var tag = native.objectProtoToString.call(value);
14
14
  return tag === native.errorTag || tag === native.domExceptionTag;
15
15
  }
16
16
 
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.objectToString.call(value);
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.objectToString.call(object) === native.objectTag && native.objectToString.call(source) === native.objectTag;
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.objectToString.call(value) === native.numberTag;
6
+ return typeof value === 'number' || native.objectProtoToString.call(value) === native.numberTag;
7
7
  }
8
8
 
9
9
  module.exports = isNumber;
@@ -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.functionToString.call(Object);
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.hasOwnProperty.call(proto, 'constructor') && proto.constructor;
17
- return typeof Ctor === 'function' && Ctor instanceof Ctor && native.functionToString.call(Ctor) === objectCtorString;
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.objectToString.call(value) === native.regExpTag;
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.objectToString.call(value) === native.stringTag;
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.objectToString.call(value) === native.symbolTag;
6
+ return typeof value === 'symbol' || native.objectProtoToString.call(value) === native.symbolTag;
7
7
  }
8
8
 
9
9
  module.exports = isSymbol;
@@ -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.objectToString.call(value);
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
@@ -3,7 +3,7 @@
3
3
  var native = require('./internals/native.js');
4
4
 
5
5
  function isWeakSet(value) {
6
- return native.objectToString.call(value) === native.weakSetTag;
6
+ return native.objectProtoToString.call(value) === native.weakSetTag;
7
7
  }
8
8
 
9
9
  module.exports = isWeakSet;
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.arrayAt === 'function') {
12
- return native.arrayAt.call(array, n);
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.4.9",
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
- "yorkie": "^2.0.0"
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 objectToString: () => string;
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 hasOwnProperty: (v: PropertyKey) => boolean;
10
- export declare const propertyIsEnumerable: (v: PropertyKey) => boolean;
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 symToStringTag: typeof Symbol.toStringTag | undefined;
14
+ export declare const symbolToStringTag: typeof Symbol.toStringTag | undefined;
14
15
  export declare const arrayProto: any[];
15
- export declare const arrSlice: (start?: number | undefined, end?: number | undefined) => any[];
16
- export declare const arrayAt: (index: number) => any;
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;