ut2 1.4.4 → 1.4.5
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/ut2.js +145 -135
- 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 -5
- package/es/internals/getTag.js +3 -31
- package/es/internals/getTagWithBugfix.js +44 -0
- package/es/internals/helpers.js +19 -10
- package/es/internals/native.js +8 -41
- package/es/internals/nodeUtil.js +1 -1
- package/es/internals/root.js +7 -0
- package/es/internals/symbolToString.js +5 -0
- package/es/internals/symbolValueOf.js +5 -0
- package/es/isArguments.js +2 -3
- package/es/isArrayBuffer.js +2 -3
- package/es/isBlob.js +6 -3
- package/es/isBoolean.js +2 -3
- package/es/isDataView.js +2 -2
- package/es/isDate.js +2 -3
- package/es/isEqual.js +5 -4
- package/es/isError.js +9 -3
- package/es/isFinite.js +2 -2
- package/es/isFunction.js +6 -3
- package/es/isInteger.js +1 -1
- package/es/isMap.js +5 -2
- package/es/isMatch.js +2 -3
- package/es/isNaN.js +1 -1
- package/es/isNumber.js +2 -3
- package/es/isPlainObject.js +4 -3
- package/es/isRegExp.js +2 -3
- package/es/isSafeInteger.js +1 -2
- package/es/isSet.js +2 -2
- package/es/isString.js +2 -3
- package/es/isSymbol.js +2 -3
- package/es/isTypedArray.js +6 -3
- package/es/isWeakMap.js +2 -2
- package/es/isWeakSet.js +2 -3
- package/es/nth.js +1 -1
- package/es/toString.js +2 -1
- package/lib/internals/getSymbols.js +2 -5
- package/lib/internals/getTag.js +2 -30
- package/lib/internals/getTagWithBugfix.js +46 -0
- package/lib/internals/helpers.js +19 -8
- package/lib/internals/native.js +7 -42
- package/lib/internals/nodeUtil.js +2 -2
- package/lib/internals/root.js +9 -0
- package/lib/internals/symbolToString.js +7 -0
- package/lib/internals/symbolValueOf.js +7 -0
- package/lib/isArguments.js +1 -2
- package/lib/isArrayBuffer.js +1 -2
- package/lib/isBlob.js +5 -2
- package/lib/isBoolean.js +1 -2
- package/lib/isDataView.js +2 -2
- package/lib/isDate.js +1 -2
- package/lib/isEqual.js +5 -4
- package/lib/isError.js +8 -2
- package/lib/isFinite.js +2 -2
- package/lib/isFunction.js +5 -2
- package/lib/isInteger.js +2 -2
- package/lib/isMap.js +5 -2
- package/lib/isMatch.js +1 -2
- package/lib/isNaN.js +2 -2
- package/lib/isNumber.js +1 -2
- package/lib/isPlainObject.js +4 -3
- package/lib/isRegExp.js +1 -2
- package/lib/isSafeInteger.js +1 -2
- package/lib/isSet.js +2 -2
- package/lib/isString.js +1 -2
- package/lib/isSymbol.js +1 -2
- package/lib/isTypedArray.js +5 -2
- package/lib/isWeakMap.js +2 -2
- package/lib/isWeakSet.js +1 -2
- package/lib/nth.js +3 -3
- package/lib/toString.js +2 -1
- package/package.json +7 -7
- package/types/internals/compare.d.ts +2 -2
- package/types/internals/getTag.d.ts +1 -2
- package/types/internals/getTagWithBugfix.d.ts +3 -0
- package/types/internals/helpers.d.ts +3 -8
- package/types/internals/native.d.ts +5 -18
- package/types/internals/root.d.ts +2 -0
- package/types/internals/symbolToString.d.ts +2 -0
- package/types/internals/symbolValueOf.d.ts +2 -0
- package/es/internals/checkType.js +0 -11
- package/lib/internals/checkType.js +0 -14
- package/types/internals/checkType.d.ts +0 -2
package/lib/toString.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var symbolToString = require('./internals/symbolToString.js');
|
|
3
4
|
var isArray = require('./isArray.js');
|
|
4
5
|
var isSymbol = require('./isSymbol.js');
|
|
5
6
|
|
|
@@ -11,7 +12,7 @@ function baseToString(value) {
|
|
|
11
12
|
return "".concat(value.map(baseToString));
|
|
12
13
|
}
|
|
13
14
|
if (isSymbol(value)) {
|
|
14
|
-
return
|
|
15
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
15
16
|
}
|
|
16
17
|
var result = '' + value;
|
|
17
18
|
return result == '0' && 1 / value === -Infinity ? '-0' : result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ut2",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"author": "caijf",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -69,23 +69,23 @@
|
|
|
69
69
|
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
70
70
|
"@rollup/plugin-replace": "^5.0.2",
|
|
71
71
|
"@rollup/plugin-terser": "^0.4.3",
|
|
72
|
-
"@rollup/plugin-typescript": "^11.1.
|
|
72
|
+
"@rollup/plugin-typescript": "^11.1.3",
|
|
73
73
|
"@types/jest": "^29.5.4",
|
|
74
74
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
75
75
|
"@typescript-eslint/parser": "^5.62.0",
|
|
76
76
|
"cross-env": "^7.0.3",
|
|
77
77
|
"cz-conventional-changelog": "^3.3.0",
|
|
78
|
-
"docdash": "^2.0.
|
|
79
|
-
"eslint": "^8.
|
|
80
|
-
"jest": "^29.6.
|
|
81
|
-
"jest-environment-jsdom": "^29.6.
|
|
78
|
+
"docdash": "^2.0.2",
|
|
79
|
+
"eslint": "^8.48.0",
|
|
80
|
+
"jest": "^29.6.4",
|
|
81
|
+
"jest-environment-jsdom": "^29.6.4",
|
|
82
82
|
"jsdoc": "^4.0.2",
|
|
83
83
|
"lint-staged": "^13.3.0",
|
|
84
84
|
"prettier": "^2.8.8",
|
|
85
85
|
"rollup": "^3.28.1",
|
|
86
86
|
"ts-jest": "^29.1.1",
|
|
87
87
|
"tslib": "^2.6.2",
|
|
88
|
-
"typescript": "^5.
|
|
88
|
+
"typescript": "^5.2.2",
|
|
89
89
|
"yorkie": "^2.0.0"
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function compareAsc(value: any, other: any):
|
|
2
|
-
export declare function compareDesc(value: any, other: any):
|
|
1
|
+
export declare function compareAsc(value: any, other: any): 0 | 1 | -1;
|
|
2
|
+
export declare function compareDesc(value: any, other: any): 0 | 1 | -1;
|
|
3
3
|
export type OrderData<T> = {
|
|
4
4
|
criteria: any[];
|
|
5
5
|
index: number;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export declare const argType = "Arguments";
|
|
2
|
-
export declare const supportedArgumentsType: boolean;
|
|
3
|
-
export declare const FUNC_ERROR_TEXT = "Expected a function";
|
|
4
|
-
export declare const numberIsFinite: (number: unknown) => boolean;
|
|
5
|
-
export declare const numberIsInteger: (number: unknown) => boolean;
|
|
6
|
-
export declare const numberIsSafeInteger: (number: unknown) => boolean;
|
|
7
|
-
export declare const objectGetOwnPropertySymbols: (o: any) => symbol[];
|
|
8
|
-
export declare const arrayAt: (index: number) => any;
|
|
9
1
|
/**
|
|
10
2
|
* ut2 版本号。
|
|
11
3
|
*
|
|
@@ -13,3 +5,6 @@ export declare const arrayAt: (index: number) => any;
|
|
|
13
5
|
* @since 1.0.0
|
|
14
6
|
*/
|
|
15
7
|
export declare const VERSION: string;
|
|
8
|
+
export declare const supportedArgumentsType: boolean;
|
|
9
|
+
export declare const FUNC_ERROR_TEXT = "Expected a function";
|
|
10
|
+
export declare function toSource(func: any): string;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export declare const root: any;
|
|
2
1
|
export declare const objectProto: Object;
|
|
3
2
|
export declare const objectToString: () => string;
|
|
3
|
+
export declare const objectGetOwnPropertySymbols: (o: any) => symbol[];
|
|
4
4
|
export declare const hasOwnProperty: (v: PropertyKey) => boolean;
|
|
5
5
|
export declare const propertyIsEnumerable: (v: PropertyKey) => boolean;
|
|
6
6
|
export declare const functionToString: () => string;
|
|
7
|
-
export declare const objectCtorString: string;
|
|
8
7
|
export declare const symbolProto: Symbol | undefined;
|
|
9
|
-
export declare const symbolValueOf: (() => symbol) | undefined;
|
|
10
|
-
export declare const symbolToString: (() => string) | undefined;
|
|
11
8
|
export declare const symToStringTag: typeof Symbol.toStringTag | undefined;
|
|
12
9
|
export declare const arrayProto: any[];
|
|
13
10
|
export declare const arrSlice: (start?: number | undefined, end?: number | undefined) => any[];
|
|
11
|
+
export declare const arrayAt: (index: number) => any;
|
|
12
|
+
export declare const numberIsFinite: (number: unknown) => boolean;
|
|
13
|
+
export declare const numberIsInteger: (number: unknown) => boolean;
|
|
14
|
+
export declare const numberIsSafeInteger: (number: unknown) => boolean;
|
|
14
15
|
/**
|
|
15
16
|
* 最大安全整数。
|
|
16
17
|
*
|
|
@@ -35,8 +36,6 @@ export declare const MIN_SAFE_INTEGER: number;
|
|
|
35
36
|
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/length | length}
|
|
36
37
|
*/
|
|
37
38
|
export declare const MAX_ARRAY_LENGTH = 4294967295;
|
|
38
|
-
export declare const blobExisted: boolean;
|
|
39
|
-
export declare function toSource(func: any): string;
|
|
40
39
|
export declare const numberTag = "[object Number]";
|
|
41
40
|
export declare const booleanTag = "[object Boolean]";
|
|
42
41
|
export declare const stringTag = "[object String]";
|
|
@@ -51,7 +50,6 @@ export declare const typedArrayTags: string[];
|
|
|
51
50
|
export declare const functionTags: string[];
|
|
52
51
|
export declare const weakSetTag = "[object WeakSet]";
|
|
53
52
|
export declare const blobTag = "[object Blob]";
|
|
54
|
-
export declare const fileTag = "[object Blob]";
|
|
55
53
|
export declare const domExceptionTag = "[object DOMException]";
|
|
56
54
|
export declare const objectTag = "[object Object]";
|
|
57
55
|
export declare const dataViewTag = "[object DataView]";
|
|
@@ -59,14 +57,3 @@ export declare const mapTag = "[object Map]";
|
|
|
59
57
|
export declare const promiseTag = "[object Promise]";
|
|
60
58
|
export declare const setTag = "[object Set]";
|
|
61
59
|
export declare const weakMapTag = "[object WeakMap]";
|
|
62
|
-
export declare const dataViewExisted: boolean;
|
|
63
|
-
export declare const mapExisted: boolean;
|
|
64
|
-
export declare const promiseExisted: boolean;
|
|
65
|
-
export declare const setExisted: boolean;
|
|
66
|
-
export declare const weakMapExisted: boolean;
|
|
67
|
-
export declare const initSource: (existed: boolean, str: string) => string;
|
|
68
|
-
export declare const dataViewCtorString: string;
|
|
69
|
-
export declare const mapCtorString: string;
|
|
70
|
-
export declare const promiseCtorString: string;
|
|
71
|
-
export declare const setCtorString: string;
|
|
72
|
-
export declare const weakMapCtorString: string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import getTag from './getTag.js';
|
|
2
|
-
|
|
3
|
-
function checkType(value, tag) {
|
|
4
|
-
return getTag(value) === tag;
|
|
5
|
-
}
|
|
6
|
-
function checkTypes(value, tags) {
|
|
7
|
-
var tag = getTag(value);
|
|
8
|
-
return tags.some(function (item) { return tag === item; });
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { checkType, checkTypes };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var getTag = require('./getTag.js');
|
|
4
|
-
|
|
5
|
-
function checkType(value, tag) {
|
|
6
|
-
return getTag(value) === tag;
|
|
7
|
-
}
|
|
8
|
-
function checkTypes(value, tags) {
|
|
9
|
-
var tag = getTag(value);
|
|
10
|
-
return tags.some(function (item) { return tag === item; });
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
exports.checkType = checkType;
|
|
14
|
-
exports.checkTypes = checkTypes;
|