ut2 1.2.2 → 1.3.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 (70) hide show
  1. package/README.md +36 -35
  2. package/dist/ut2.js +429 -245
  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/index.js +30 -29
  7. package/es/internals/compare.js +23 -6
  8. package/es/internals/getTag.js +7 -9
  9. package/es/internals/helpers.js +3 -2
  10. package/es/internals/native.js +17 -1
  11. package/es/isArguments.js +1 -3
  12. package/es/isArrayBuffer.js +1 -3
  13. package/es/isEqual.js +185 -0
  14. package/es/isSafeInteger.js +1 -3
  15. package/es/isTypedArray.js +1 -15
  16. package/lib/index.js +60 -58
  17. package/lib/internals/compare.js +23 -6
  18. package/lib/internals/getTag.js +6 -8
  19. package/lib/internals/helpers.js +3 -2
  20. package/lib/internals/native.js +16 -0
  21. package/lib/isArguments.js +1 -3
  22. package/lib/isArrayBuffer.js +1 -3
  23. package/lib/isEqual.js +187 -0
  24. package/lib/isSafeInteger.js +1 -3
  25. package/lib/isTypedArray.js +1 -15
  26. package/package.json +1 -1
  27. package/types/difference.d.ts +1 -1
  28. package/types/eq.d.ts +1 -1
  29. package/types/index.d.ts +42 -41
  30. package/types/internals/native.d.ts +16 -0
  31. package/types/intersection.d.ts +1 -1
  32. package/types/isArguments.d.ts +1 -1
  33. package/types/isArray.d.ts +1 -1
  34. package/types/isArrayBuffer.d.ts +1 -1
  35. package/types/isArrayLike.d.ts +1 -1
  36. package/types/isArrayLikeObject.d.ts +1 -1
  37. package/types/isBlob.d.ts +1 -1
  38. package/types/isBoolean.d.ts +1 -1
  39. package/types/isBuffer.d.ts +1 -1
  40. package/types/isDataView.d.ts +1 -1
  41. package/types/isDate.d.ts +1 -1
  42. package/types/isElement.d.ts +1 -1
  43. package/types/isEmpty.d.ts +1 -1
  44. package/types/isEqual.d.ts +44 -0
  45. package/types/isError.d.ts +1 -1
  46. package/types/isFinite.d.ts +1 -1
  47. package/types/isFunction.d.ts +1 -1
  48. package/types/isInteger.d.ts +1 -1
  49. package/types/isLength.d.ts +1 -1
  50. package/types/isMap.d.ts +1 -1
  51. package/types/isNaN.d.ts +1 -1
  52. package/types/isNil.d.ts +1 -1
  53. package/types/isNull.d.ts +1 -1
  54. package/types/isNumber.d.ts +1 -1
  55. package/types/isObject.d.ts +1 -1
  56. package/types/isObjectLike.d.ts +1 -1
  57. package/types/isPlainObject.d.ts +1 -1
  58. package/types/isPromiseLike.d.ts +1 -1
  59. package/types/isRegExp.d.ts +1 -1
  60. package/types/isSafeInteger.d.ts +1 -1
  61. package/types/isSet.d.ts +1 -1
  62. package/types/isString.d.ts +1 -1
  63. package/types/isSymbol.d.ts +1 -1
  64. package/types/isTypedArray.d.ts +1 -1
  65. package/types/isUndefined.d.ts +1 -1
  66. package/types/isWeakMap.d.ts +1 -1
  67. package/types/isWeakSet.d.ts +1 -1
  68. package/types/union.d.ts +1 -1
  69. package/types/uniq.d.ts +1 -1
  70. package/types/xor.d.ts +1 -1
@@ -3,11 +3,11 @@
3
3
  var native = require('./native.js');
4
4
 
5
5
  function getRawTag(value) {
6
- var isOwn = native.hasOwnProperty.call(value, Symbol.toStringTag);
7
- var tag = value[Symbol.toStringTag];
6
+ var isOwn = native.hasOwnProperty.call(value, native.symToStringTag);
7
+ var tag = value[native.symToStringTag];
8
8
  var unmasked = false;
9
9
  try {
10
- value[Symbol.toStringTag] = undefined;
10
+ value[native.symToStringTag] = undefined;
11
11
  unmasked = true;
12
12
  }
13
13
  catch (e) {
@@ -15,18 +15,16 @@ function getRawTag(value) {
15
15
  var result = native.objectToString.call(value);
16
16
  if (unmasked) {
17
17
  if (isOwn) {
18
- value[Symbol.toStringTag] = tag;
18
+ value[native.symToStringTag] = tag;
19
19
  }
20
20
  else {
21
- delete value[Symbol.toStringTag];
21
+ delete value[native.symToStringTag];
22
22
  }
23
23
  }
24
24
  return result;
25
25
  }
26
26
  function _getTag(value) {
27
- return Symbol && Symbol.toStringTag && Symbol.toStringTag in Object(value)
28
- ? getRawTag(value)
29
- : native.objectToString.call(value);
27
+ return native.symToStringTag && native.symToStringTag in Object(value) ? getRawTag(value) : native.objectToString.call(value);
30
28
  }
31
29
  var getTag = _getTag;
32
30
  if ((native.dataViewExisted && native.objectToString.call(new DataView(new ArrayBuffer(1))) !== native.dataViewTag) ||
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var isType = require('./isType.js');
4
+ var native = require('./native.js');
4
5
 
5
6
  exports.argType = 'Arguments';
6
7
  exports.supportedArgumentsType = isType((function () { return arguments; })(), exports.argType);
@@ -9,5 +10,5 @@ exports.numberIsFinite = Number.isFinite;
9
10
  exports.numberIsInteger = Number.isInteger;
10
11
  exports.numberIsSafeInteger = Number.isSafeInteger;
11
12
  exports.objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
12
- exports.arrayAt = Array.prototype.at;
13
- exports.VERSION = "1.2.2";
13
+ exports.arrayAt = native.arrayProto.at;
14
+ exports.VERSION = "1.3.0";
@@ -10,6 +10,12 @@ exports.hasOwnProperty = exports.objectProto.hasOwnProperty;
10
10
  exports.propertyIsEnumerable = exports.objectProto.propertyIsEnumerable;
11
11
  exports.functionToString = Function.prototype.toString;
12
12
  exports.objectCtorString = exports.functionToString.call(Object);
13
+ exports.symbolProto = Symbol ? Symbol.prototype : undefined;
14
+ exports.symbolValueOf = exports.symbolProto ? exports.symbolProto.valueOf : undefined;
15
+ exports.symbolProto ? exports.symbolProto.toString : undefined;
16
+ exports.symToStringTag = Symbol ? Symbol.toStringTag : undefined;
17
+ exports.arrayProto = Array.prototype;
18
+ exports.arrSlice = Array.prototype.slice;
13
19
  exports.MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
14
20
  exports.MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
15
21
  exports.MAX_ARRAY_LENGTH = 4294967295;
@@ -29,6 +35,16 @@ function toSource(func) {
29
35
  }
30
36
  return '';
31
37
  }
38
+ exports.numberTag = '[object Number]';
39
+ exports.booleanTag = '[object Boolean]';
40
+ exports.stringTag = '[object String]';
41
+ exports.dateTag = '[object Date]';
42
+ exports.regExpTag = '[object RegExp]';
43
+ exports.symbolTag = '[object Symbol]';
44
+ exports.errorTag = '[object Error]';
45
+ exports.arrayBufferTag = '[object ArrayBuffer]';
46
+ exports.argumentsTag = '[object Arguments]';
47
+ exports.arrayTag = '[object Array]';
32
48
  exports.objectTag = '[object Object]';
33
49
  exports.dataViewTag = '[object DataView]';
34
50
  exports.mapTag = '[object Map]';
@@ -9,9 +9,7 @@ function isArguments(value) {
9
9
  if (helpers.supportedArgumentsType) {
10
10
  return isObjectLike(value) && isType(value, helpers.argType);
11
11
  }
12
- return (isObjectLike(value) &&
13
- native.hasOwnProperty.call(value, 'callee') &&
14
- !native.propertyIsEnumerable.call(value, 'callee'));
12
+ return isObjectLike(value) && native.hasOwnProperty.call(value, 'callee') && !native.propertyIsEnumerable.call(value, 'callee');
15
13
  }
16
14
 
17
15
  module.exports = isArguments;
@@ -5,9 +5,7 @@ var nodeUtil = require('./internals/nodeUtil.js');
5
5
  var isObjectLike = require('./isObjectLike.js');
6
6
 
7
7
  function isArrayBuffer(value) {
8
- return nodeUtil.nodeIsArrayBuffer
9
- ? nodeUtil.nodeIsArrayBuffer(value)
10
- : isObjectLike(value) && isType(value, 'ArrayBuffer');
8
+ return nodeUtil.nodeIsArrayBuffer ? nodeUtil.nodeIsArrayBuffer(value) : isObjectLike(value) && isType(value, 'ArrayBuffer');
11
9
  }
12
10
 
13
11
  module.exports = isArrayBuffer;
package/lib/isEqual.js ADDED
@@ -0,0 +1,187 @@
1
+ 'use strict';
2
+
3
+ var allKeys = require('./allKeys.js');
4
+ var eq = require('./eq.js');
5
+ var getTag = require('./internals/getTag.js');
6
+ var native = require('./internals/native.js');
7
+ var isBuffer = require('./isBuffer.js');
8
+ var isFunction = require('./isFunction.js');
9
+ var isNil = require('./isNil.js');
10
+ var isObjectLike = require('./isObjectLike.js');
11
+ var isTypedArray = require('./isTypedArray.js');
12
+ var orderBy = require('./orderBy.js');
13
+
14
+ function mapToArray(map) {
15
+ var result = [];
16
+ map.forEach(function (value, key) {
17
+ result.push([key, value]);
18
+ });
19
+ return orderBy(result, function (item) { return item[0]; });
20
+ }
21
+ function setToArray(set) {
22
+ var result = [];
23
+ set.forEach(function (value) {
24
+ result.push(value);
25
+ });
26
+ return orderBy(result);
27
+ }
28
+ function argToArray(arg) {
29
+ return native.arrSlice.call(arg);
30
+ }
31
+ function toBufferView(bufferSource) {
32
+ return new Uint8Array(bufferSource.buffer || bufferSource, bufferSource.byteOffset || 0, bufferSource.byteLength);
33
+ }
34
+ function isDomNode(obj) {
35
+ return isObjectLike(obj) && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string' && typeof obj.isEqualNode === 'function';
36
+ }
37
+ function isEqualDeep(value, other, customizer, strictCheck, valueStack, otherStack) {
38
+ if (eq(value, other, strictCheck)) {
39
+ return true;
40
+ }
41
+ var valType = typeof value;
42
+ var othType = typeof other;
43
+ if (strictCheck && valType !== othType) {
44
+ return false;
45
+ }
46
+ if (isNil(value) || isNil(other) || (valType !== 'object' && othType !== 'object')) {
47
+ return false;
48
+ }
49
+ var tag = getTag(value);
50
+ if (tag !== getTag(other)) {
51
+ return false;
52
+ }
53
+ var convert;
54
+ switch (tag) {
55
+ case native.numberTag:
56
+ return eq(+value, +other, strictCheck);
57
+ case native.booleanTag:
58
+ case native.dateTag:
59
+ return strictCheck ? +value === +other : eq(+value, +other);
60
+ case native.stringTag:
61
+ case native.regExpTag:
62
+ return '' + value === '' + other;
63
+ case native.symbolTag:
64
+ return native.symbolValueOf ? native.symbolValueOf.call(value) === native.symbolValueOf.call(other) : false;
65
+ case native.errorTag:
66
+ return value.name == other.name && value.message == other.message;
67
+ case native.dataViewTag:
68
+ case native.arrayBufferTag:
69
+ if (value.byteLength !== other.byteLength || (value.byteOffset && value.byteOffset !== other.byteOffset)) {
70
+ return false;
71
+ }
72
+ convert = toBufferView;
73
+ break;
74
+ case native.mapTag:
75
+ convert = mapToArray;
76
+ break;
77
+ case native.setTag:
78
+ convert = setToArray;
79
+ break;
80
+ case native.argumentsTag:
81
+ convert = argToArray;
82
+ break;
83
+ }
84
+ if (convert) {
85
+ return isEqualDeep(convert(value), convert(other), customizer, strictCheck, valueStack, otherStack);
86
+ }
87
+ if (isDomNode(value) && isDomNode(other)) {
88
+ return value.isEqualNode(other);
89
+ }
90
+ var areArrays = tag === native.arrayTag;
91
+ if (!areArrays && isTypedArray(value)) {
92
+ if (value.byteLength !== other.byteLength) {
93
+ return false;
94
+ }
95
+ if (value.buffer === other.buffer && value.byteOffset === other.byteOffset) {
96
+ return true;
97
+ }
98
+ areArrays = true;
99
+ }
100
+ if (isBuffer(value)) {
101
+ if (!isBuffer(other)) {
102
+ return false;
103
+ }
104
+ areArrays = true;
105
+ }
106
+ valueStack = valueStack || [];
107
+ otherStack = otherStack || [];
108
+ var length = valueStack.length;
109
+ while (length--) {
110
+ if (valueStack[length] === value) {
111
+ return otherStack[length] === other;
112
+ }
113
+ }
114
+ valueStack.push(value);
115
+ otherStack.push(other);
116
+ var result = true;
117
+ var hasCustomizer = typeof customizer === 'function';
118
+ if (areArrays) {
119
+ length = value.length;
120
+ if (length !== other.length) {
121
+ return false;
122
+ }
123
+ while (length--) {
124
+ if (hasCustomizer) {
125
+ var compared = customizer(value[length], other[length], length, value, other, valueStack, otherStack);
126
+ if (compared !== undefined) {
127
+ result = !!compared;
128
+ break;
129
+ }
130
+ }
131
+ if (!isEqualDeep(value[length], other[length], customizer, strictCheck, valueStack, otherStack)) {
132
+ result = false;
133
+ break;
134
+ }
135
+ }
136
+ }
137
+ else if (tag === native.objectTag) {
138
+ var keys = allKeys(value);
139
+ length = keys.length;
140
+ if (allKeys(other).length !== length) {
141
+ return false;
142
+ }
143
+ var skipCtor = false;
144
+ while (length--) {
145
+ var key = keys[length];
146
+ if (hasCustomizer) {
147
+ var compared = customizer(value[key], other[key], key, value, other, valueStack, otherStack);
148
+ if (compared !== undefined) {
149
+ result = !!compared;
150
+ break;
151
+ }
152
+ }
153
+ if (!(native.hasOwnProperty.call(other, key) && isEqualDeep(value[key], other[key], customizer, strictCheck, valueStack, otherStack))) {
154
+ result = false;
155
+ break;
156
+ }
157
+ if (!skipCtor && key === 'constructor') {
158
+ skipCtor = true;
159
+ }
160
+ }
161
+ if (result && !skipCtor) {
162
+ var valCtor = value.constructor;
163
+ var othCtor = other.constructor;
164
+ if (valCtor !== othCtor && !(isFunction(valCtor) && valCtor instanceof valCtor && isFunction(othCtor) && othCtor instanceof othCtor) && 'constructor' in value && 'constructor' in other) {
165
+ result = false;
166
+ }
167
+ }
168
+ }
169
+ else {
170
+ result = false;
171
+ }
172
+ valueStack.pop();
173
+ otherStack.pop();
174
+ return result;
175
+ }
176
+ function isEqual(value, other, customizer, strictCheck) {
177
+ if (strictCheck === void 0) { strictCheck = false; }
178
+ if (typeof customizer === 'function') {
179
+ var result = customizer(value, other);
180
+ if (result !== undefined) {
181
+ return !!result;
182
+ }
183
+ }
184
+ return isEqualDeep(value, other, customizer, strictCheck);
185
+ }
186
+
187
+ module.exports = isEqual;
@@ -5,9 +5,7 @@ var helpers = require('./internals/helpers.js');
5
5
  var isInteger = require('./isInteger.js');
6
6
 
7
7
  function isSafeInteger(value) {
8
- return helpers.numberIsSafeInteger
9
- ? helpers.numberIsSafeInteger(value)
10
- : isInteger(value) && Math.abs(value) <= native.MAX_SAFE_INTEGER;
8
+ return helpers.numberIsSafeInteger ? helpers.numberIsSafeInteger(value) : isInteger(value) && Math.abs(value) <= native.MAX_SAFE_INTEGER;
11
9
  }
12
10
 
13
11
  module.exports = isSafeInteger;
@@ -9,21 +9,7 @@ function isTypedArray(value) {
9
9
  if (nodeUtil.nodeIsTypedArray) {
10
10
  return nodeUtil.nodeIsTypedArray(value);
11
11
  }
12
- return (isObjectLike(value) &&
13
- isLength(value.length) &&
14
- isType(value, [
15
- 'Float32Array',
16
- 'Float64Array',
17
- 'Int8Array',
18
- 'Int16Array',
19
- 'Int32Array',
20
- 'Uint8Array',
21
- 'Uint8ClampedArray',
22
- 'Uint16Array',
23
- 'Uint32Array',
24
- 'BigInt64Array',
25
- 'BigUint64Array'
26
- ]));
12
+ return isObjectLike(value) && isLength(value.length) && isType(value, ['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array']);
27
13
  }
28
14
 
29
15
  module.exports = isTypedArray;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ut2",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "author": "caijf",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -11,7 +11,7 @@
11
11
  * @param {Array} array 要检查的数组。
12
12
  * @param {Array} values 排除的值。
13
13
  * @param {Function | string} [iteratee] 迭代函数,调用每个元素。
14
- * @param {boolean} [strictCheck=false] 严格比较,区分 `+0` `-0`。
14
+ * @param {boolean} [strictCheck=false] 严格比较,区分 `0` `-0`,默认 `false` 。
15
15
  * @returns {Array} 过滤值后的新数组。
16
16
  * @example
17
17
  *
package/types/eq.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Equality_comparisons_and_sameness | JavaScript 中的相等性判断}
10
10
  * @param {*} value 要比较的值。
11
11
  * @param {*} other 另一个要比较的值。
12
- * @param {boolean} [strictCheck=false] 严格比较,区分 `+0` `-0`。
12
+ * @param {boolean} [strictCheck=false] 严格比较,区分 `0` `-0`,默认 `false` 。
13
13
  * @returns {boolean} 如果两个值相等,返回 `true` ,否则返回 `false` 。
14
14
  * @example
15
15
  *
package/types/index.d.ts CHANGED
@@ -41,6 +41,48 @@ export { default as negate } from './negate';
41
41
  export { default as once } from './once';
42
42
  export { default as partial } from './partial';
43
43
  export { default as throttle } from './throttle';
44
+ /**
45
+ * 语言
46
+ *
47
+ * @module Language
48
+ * @since 1.0.0
49
+ */
50
+ export { default as isArguments } from './isArguments';
51
+ export { default as isArray } from './isArray';
52
+ export { default as isArrayBuffer } from './isArrayBuffer';
53
+ export { default as isArrayLike } from './isArrayLike';
54
+ export { default as isArrayLikeObject } from './isArrayLikeObject';
55
+ export { default as isBlob } from './isBlob';
56
+ export { default as isBoolean } from './isBoolean';
57
+ export { default as isBuffer } from './isBuffer';
58
+ export { default as isDataView } from './isDataView';
59
+ export { default as isDate } from './isDate';
60
+ export { default as isElement } from './isElement';
61
+ export { default as isEmpty } from './isEmpty';
62
+ export { default as isEqual } from './isEqual';
63
+ export { default as isError } from './isError';
64
+ export { default as isFinite } from './isFinite';
65
+ export { default as isFunction } from './isFunction';
66
+ export { default as isInteger } from './isInteger';
67
+ export { default as isLength } from './isLength';
68
+ export { default as isMap } from './isMap';
69
+ export { default as isNaN } from './isNaN';
70
+ export { default as isNil } from './isNil';
71
+ export { default as isNull } from './isNull';
72
+ export { default as isNumber } from './isNumber';
73
+ export { default as isObject } from './isObject';
74
+ export { default as isObjectLike } from './isObjectLike';
75
+ export { default as isPlainObject } from './isPlainObject';
76
+ export { default as isPromiseLike } from './isPromiseLike';
77
+ export { default as isRegExp } from './isRegExp';
78
+ export { default as isSafeInteger } from './isSafeInteger';
79
+ export { default as isSet } from './isSet';
80
+ export { default as isString } from './isString';
81
+ export { default as isSymbol } from './isSymbol';
82
+ export { default as isTypedArray } from './isTypedArray';
83
+ export { default as isUndefined } from './isUndefined';
84
+ export { default as isWeakMap } from './isWeakMap';
85
+ export { default as isWeakSet } from './isWeakSet';
44
86
  /**
45
87
  * 数学
46
88
  *
@@ -94,47 +136,6 @@ export { default as unescape } from './unescape';
94
136
  export { default as upperCase } from './upperCase';
95
137
  export { default as upperFirst } from './upperFirst';
96
138
  export { default as words } from './words';
97
- /**
98
- * 类型检测
99
- *
100
- * @module Type
101
- * @since 1.0.0
102
- */
103
- export { default as isArguments } from './isArguments';
104
- export { default as isArray } from './isArray';
105
- export { default as isArrayBuffer } from './isArrayBuffer';
106
- export { default as isArrayLike } from './isArrayLike';
107
- export { default as isArrayLikeObject } from './isArrayLikeObject';
108
- export { default as isBlob } from './isBlob';
109
- export { default as isBoolean } from './isBoolean';
110
- export { default as isBuffer } from './isBuffer';
111
- export { default as isDataView } from './isDataView';
112
- export { default as isDate } from './isDate';
113
- export { default as isElement } from './isElement';
114
- export { default as isEmpty } from './isEmpty';
115
- export { default as isError } from './isError';
116
- export { default as isFinite } from './isFinite';
117
- export { default as isFunction } from './isFunction';
118
- export { default as isInteger } from './isInteger';
119
- export { default as isLength } from './isLength';
120
- export { default as isMap } from './isMap';
121
- export { default as isNaN } from './isNaN';
122
- export { default as isNil } from './isNil';
123
- export { default as isNull } from './isNull';
124
- export { default as isNumber } from './isNumber';
125
- export { default as isObject } from './isObject';
126
- export { default as isObjectLike } from './isObjectLike';
127
- export { default as isPlainObject } from './isPlainObject';
128
- export { default as isPromiseLike } from './isPromiseLike';
129
- export { default as isRegExp } from './isRegExp';
130
- export { default as isSafeInteger } from './isSafeInteger';
131
- export { default as isSet } from './isSet';
132
- export { default as isString } from './isString';
133
- export { default as isSymbol } from './isSymbol';
134
- export { default as isTypedArray } from './isTypedArray';
135
- export { default as isUndefined } from './isUndefined';
136
- export { default as isWeakMap } from './isWeakMap';
137
- export { default as isWeakSet } from './isWeakSet';
138
139
  /**
139
140
  * 工具
140
141
  *
@@ -5,6 +5,12 @@ export declare const hasOwnProperty: (v: PropertyKey) => boolean;
5
5
  export declare const propertyIsEnumerable: (v: PropertyKey) => boolean;
6
6
  export declare const functionToString: () => string;
7
7
  export declare const objectCtorString: string;
8
+ export declare const symbolProto: Symbol | undefined;
9
+ export declare const symbolValueOf: (() => symbol) | undefined;
10
+ export declare const symbolToString: (() => string) | undefined;
11
+ export declare const symToStringTag: typeof Symbol.toStringTag | undefined;
12
+ export declare const arrayProto: any[];
13
+ export declare const arrSlice: (start?: number | undefined, end?: number | undefined) => any[];
8
14
  /**
9
15
  * 最大安全整数。
10
16
  *
@@ -31,6 +37,16 @@ export declare const MIN_SAFE_INTEGER: number;
31
37
  export declare const MAX_ARRAY_LENGTH = 4294967295;
32
38
  export declare const blobExisted: boolean;
33
39
  export declare function toSource(func: any): string;
40
+ export declare const numberTag = "[object Number]";
41
+ export declare const booleanTag = "[object Boolean]";
42
+ export declare const stringTag = "[object String]";
43
+ export declare const dateTag = "[object Date]";
44
+ export declare const regExpTag = "[object RegExp]";
45
+ export declare const symbolTag = "[object Symbol]";
46
+ export declare const errorTag = "[object Error]";
47
+ export declare const arrayBufferTag = "[object ArrayBuffer]";
48
+ export declare const argumentsTag = "[object Arguments]";
49
+ export declare const arrayTag = "[object Array]";
34
50
  export declare const objectTag = "[object Object]";
35
51
  export declare const dataViewTag = "[object DataView]";
36
52
  export declare const mapTag = "[object Map]";
@@ -11,7 +11,7 @@
11
11
  * @param {Array} array 要检查的数组。
12
12
  * @param {Array} other 另一个要检查的数组。
13
13
  * @param {Function | string} [iteratee] 迭代函数,调用每个元素。
14
- * @param {boolean} [strictCheck=false] 严格比较,区分 `+0` `-0`。
14
+ * @param {boolean} [strictCheck=false] 严格比较,区分 `0` `-0`,默认 `false` 。
15
15
  * @returns {Array} 包含所有传入数组交集元素的新数组。
16
16
  * @example
17
17
  *
@@ -2,7 +2,7 @@
2
2
  * 检查值是否为 `arguments` 对象。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isArguments
5
+ * @alias module:Language.isArguments
6
6
  * @since 1.0.0
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为 `arguments` 对象,返回 `true` ,否则返回 `false` 。
@@ -2,7 +2,7 @@
2
2
  * 检查值是否为 `Array` 对象。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isArray
5
+ * @alias module:Language.isArray
6
6
  * @since 1.0.0
7
7
  * @param {*} value 要检查的值
8
8
  * @returns {boolean} 如果值为 `Array` 对象,返回 `true` ,否则返回 `false` 。
@@ -2,7 +2,7 @@
2
2
  * 检查值是否为 `ArrayBuffer` 对象。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isArrayBuffer
5
+ * @alias module:Language.isArrayBuffer
6
6
  * @since 1.0.0
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为 `ArrayBuffer` 对象,返回 `true` ,否则返回 `false` 。
@@ -4,7 +4,7 @@
4
4
  * 如果一个值不是函数并且其 `value.length` 是大于或等于 `0` 且小于或等于 `Number.MAX_SAFE_INTEGER` 的整数,则该值被视为类数组。
5
5
  *
6
6
  * @static
7
- * @alias module:Type.isArrayLike
7
+ * @alias module:Language.isArrayLike
8
8
  * @since 1.0.0
9
9
  * @param {*} value 要检查的值。
10
10
  * @returns {boolean} 如果值为类数组,返回 `true` ,否则返回 `false` 。
@@ -2,7 +2,7 @@
2
2
  * 检查值是否为类数组对象。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isArrayLikeObject
5
+ * @alias module:Language.isArrayLikeObject
6
6
  * @since 1.0.0
7
7
  * @param {*} value 要检查的值
8
8
  * @returns {boolean} 如果值为类数组对象,返回 `true` ,否则返回 `false` 。
package/types/isBlob.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * 浏览器环境的 `Blob` 或 `File` 对象,或其他继承自 `Blob` 的实例,都将返回 `true` 。
5
5
  *
6
6
  * @static
7
- * @alias module:Type.isBlob
7
+ * @alias module:Language.isBlob
8
8
  * @since 1.0.0
9
9
  * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/Blob | Blob}
10
10
  * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/File | File}
@@ -2,7 +2,7 @@
2
2
  * 检查值是否为布尔类型或对象。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isBoolean
5
+ * @alias module:Language.isBoolean
6
6
  * @since 1.0.0
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为布尔类型或对象,返回 `true` 否则返回 `false` 。
@@ -5,7 +5,7 @@
5
5
  * 非 Node.js 环境,始终返回 `false` 。
6
6
  *
7
7
  * @static
8
- * @alias module:Type.isBuffer
8
+ * @alias module:Language.isBuffer
9
9
  * @since 1.0.0
10
10
  * @param {*} value 要检查的值
11
11
  * @returns {boolean} 如果值为 `buffer` ,返回 `true` ,否则返回 `false` 。
@@ -2,7 +2,7 @@
2
2
  * 检查值是否为 `DataView` 对象。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isDataView
5
+ * @alias module:Language.isDataView
6
6
  * @since 1.2.0
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为 `DataView` 对象,返回 `true` ,否则返回 `false` 。
package/types/isDate.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * 检查值是否为 `Date` 对象。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isDate
5
+ * @alias module:Language.isDate
6
6
  * @since 1.0.0
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为 `Date` 对象,返回 `true` ,否则返回 `false` 。
@@ -2,7 +2,7 @@
2
2
  * 检查值是否可能为 `DOM` 元素。
3
3
  *
4
4
  * @static
5
- * @alias module:Type.isElement
5
+ * @alias module:Language.isElement
6
6
  * @since 1.0.0
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为 `DOM` 元素,返回 `true` ,否则返回 `false` 。
@@ -6,7 +6,7 @@
6
6
  * 非上述类型值,都将被认为是空的。
7
7
  *
8
8
  * @static
9
- * @alias module:Type.isEmpty
9
+ * @alias module:Language.isEmpty
10
10
  * @since 1.0.0
11
11
  * @param {*} value 要检查的值。
12
12
  * @returns {boolean} 如果值为空,返回 `true` ,否则返回 `false` 。
@@ -0,0 +1,44 @@
1
+ type Customizer = (objValue: any, othValue: any, key?: number | string | symbol, object?: any, other?: any, valueStack?: any[], otherStack?: any[]) => void | undefined | boolean;
2
+ /**
3
+ * 深度比较两个值是否相等。
4
+ *
5
+ * 支持比较 `boolean` `number` `string` `symbol` `array` `array buffer` `date` `error` `map` `object` `regexp` `set` `typed array` 类型。对象只比较自身的属性,不包括继承和不可枚举的属性。
6
+ *
7
+ * 如果 `strictCheck=true` , 以下值不相等:
8
+ *
9
+ * 1. `0` `-0`
10
+ * 2. `typeof` 不同类型,如 `1` `Object(1)`
11
+ * 3. 无效日期对象,如 `new Date('')` `new Date('abc')`
12
+ *
13
+ * @static
14
+ * @alias module:Language.isEqual
15
+ * @since 1.3.0
16
+ * @param {*} value 要比较的值。
17
+ * @param {*} other 另一个要比较的值。
18
+ * @param {Function} [customizer] 自定义比较。
19
+ * @param {boolean} [strictCheck=false] 严格比较,默认 `false` 。
20
+ * @returns {boolean} 如果两个值相等,返回 `true` ,否则返回 `false` 。
21
+ * @example
22
+ *
23
+ * const value = { a: 1, b: -0 }
24
+ * const other = { a: 1, b: 0 }
25
+ *
26
+ * isEqual(value, other); // true
27
+ * value === other // false
28
+ *
29
+ * // 严格比较
30
+ * isEqual(value, other, undefined, true); // false
31
+ *
32
+ * // 自定义比较
33
+ * function customizer(value, other){
34
+ * if(typeof value === 'string' && typeof other === 'string'){
35
+ * return true;
36
+ * }
37
+ * }
38
+ * isEqual('a', 'b', customizer); // true
39
+ * isEqual(['a'], ['b'], customizer); // true
40
+ * isEqual({foo: 'a'}, {foo: 'b'}, customizer); // true
41
+ *
42
+ */
43
+ declare function isEqual(value: any, other: any, customizer?: Customizer, strictCheck?: boolean): boolean;
44
+ export default isEqual;