ut2 1.3.2 → 1.4.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 (58) hide show
  1. package/dist/ut2.js +104 -33
  2. package/dist/ut2.js.map +1 -1
  3. package/dist/ut2.min.js +1 -1
  4. package/dist/ut2.min.js.map +1 -1
  5. package/es/index.js +1 -0
  6. package/es/internals/checkType.js +11 -0
  7. package/es/internals/helpers.js +5 -6
  8. package/es/internals/native.js +10 -1
  9. package/es/isArguments.js +4 -4
  10. package/es/isArrayBuffer.js +3 -3
  11. package/es/isBlob.js +3 -3
  12. package/es/isBoolean.js +3 -2
  13. package/es/isDataView.js +3 -2
  14. package/es/isDate.js +3 -3
  15. package/es/isError.js +3 -5
  16. package/es/isFunction.js +3 -2
  17. package/es/isMap.js +3 -3
  18. package/es/isMatch.js +71 -0
  19. package/es/isNumber.js +3 -3
  20. package/es/isPlainObject.js +3 -3
  21. package/es/isRegExp.js +3 -3
  22. package/es/isSet.js +3 -3
  23. package/es/isString.js +3 -3
  24. package/es/isSymbol.js +3 -3
  25. package/es/isTypedArray.js +3 -2
  26. package/es/isWeakMap.js +3 -3
  27. package/es/isWeakSet.js +3 -3
  28. package/lib/index.js +2 -0
  29. package/lib/internals/checkType.js +14 -0
  30. package/lib/internals/helpers.js +3 -4
  31. package/lib/internals/native.js +9 -0
  32. package/lib/isArguments.js +2 -2
  33. package/lib/isArrayBuffer.js +3 -3
  34. package/lib/isBlob.js +2 -2
  35. package/lib/isBoolean.js +3 -2
  36. package/lib/isDataView.js +3 -2
  37. package/lib/isDate.js +3 -3
  38. package/lib/isError.js +3 -5
  39. package/lib/isFunction.js +3 -2
  40. package/lib/isMap.js +3 -3
  41. package/lib/isMatch.js +73 -0
  42. package/lib/isNumber.js +3 -3
  43. package/lib/isPlainObject.js +2 -2
  44. package/lib/isRegExp.js +3 -3
  45. package/lib/isSet.js +3 -3
  46. package/lib/isString.js +3 -3
  47. package/lib/isSymbol.js +3 -3
  48. package/lib/isTypedArray.js +3 -2
  49. package/lib/isWeakMap.js +3 -3
  50. package/lib/isWeakSet.js +3 -3
  51. package/package.json +1 -1
  52. package/types/index.d.ts +1 -0
  53. package/types/internals/checkType.d.ts +2 -0
  54. package/types/internals/native.d.ts +6 -0
  55. package/types/isMatch.d.ts +44 -0
  56. package/es/internals/isType.js +0 -11
  57. package/lib/internals/isType.js +0 -13
  58. package/types/internals/isType.d.ts +0 -11
package/es/index.js CHANGED
@@ -42,6 +42,7 @@ export { default as isFunction } from './isFunction.js';
42
42
  export { default as isInteger } from './isInteger.js';
43
43
  export { default as isLength } from './isLength.js';
44
44
  export { default as isMap } from './isMap.js';
45
+ export { default as isMatch } from './isMatch.js';
45
46
  export { default as isNaN } from './isNaN.js';
46
47
  export { default as isNil } from './isNil.js';
47
48
  export { default as isNull } from './isNull.js';
@@ -0,0 +1,11 @@
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 +1,13 @@
1
- import isType from './isType.js';
2
- import { arrayProto } from './native.js';
1
+ import { checkType } from './checkType.js';
2
+ import { arrayProto, argumentsTag } from './native.js';
3
3
 
4
- var argType = 'Arguments';
5
- var supportedArgumentsType = isType((function () { return arguments; })(), argType);
4
+ var supportedArgumentsType = checkType((function () { return arguments; })(), argumentsTag);
6
5
  var FUNC_ERROR_TEXT = 'Expected a function';
7
6
  var numberIsFinite = Number.isFinite;
8
7
  var numberIsInteger = Number.isInteger;
9
8
  var numberIsSafeInteger = Number.isSafeInteger;
10
9
  var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
11
10
  var arrayAt = arrayProto.at;
12
- var VERSION = "1.3.2";
11
+ var VERSION = "1.4.0";
13
12
 
14
- export { FUNC_ERROR_TEXT, VERSION, argType, arrayAt, numberIsFinite, numberIsInteger, numberIsSafeInteger, objectGetOwnPropertySymbols, supportedArgumentsType };
13
+ export { FUNC_ERROR_TEXT, VERSION, arrayAt, numberIsFinite, numberIsInteger, numberIsSafeInteger, objectGetOwnPropertySymbols, supportedArgumentsType };
@@ -33,6 +33,9 @@ function toSource(func) {
33
33
  }
34
34
  return '';
35
35
  }
36
+ function wrapTags(tags) {
37
+ return tags.map(function (item) { return '[object ' + item + ']'; });
38
+ }
36
39
  var numberTag = '[object Number]';
37
40
  var booleanTag = '[object Boolean]';
38
41
  var stringTag = '[object String]';
@@ -43,6 +46,12 @@ var errorTag = '[object Error]';
43
46
  var arrayBufferTag = '[object ArrayBuffer]';
44
47
  var argumentsTag = '[object Arguments]';
45
48
  var arrayTag = '[object Array]';
49
+ var typedArrayTags = wrapTags(['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array']);
50
+ var functionTags = wrapTags(['Function', 'AsyncFunction', 'GeneratorFunction', 'Proxy']);
51
+ var weakSetTag = '[object WeakSet]';
52
+ var blobTag = '[object Blob]';
53
+ var fileTag = '[object Blob]';
54
+ var domExceptionTag = '[object DOMException]';
46
55
  var objectTag = '[object Object]';
47
56
  var dataViewTag = '[object DataView]';
48
57
  var mapTag = '[object Map]';
@@ -61,4 +70,4 @@ var promiseCtorString = initSource(promiseExisted, toSource(Promise));
61
70
  var setCtorString = initSource(setExisted, toSource(Set));
62
71
  var weakMapCtorString = initSource(weakMapExisted, toSource(WeakMap));
63
72
 
64
- export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag, arrSlice, arrayBufferTag, arrayProto, arrayTag, blobExisted, booleanTag, dataViewCtorString, dataViewExisted, dataViewTag, dateTag, errorTag, functionToString, hasOwnProperty, initSource, mapCtorString, mapExisted, mapTag, numberTag, objectCtorString, objectProto, objectTag, objectToString, promiseCtorString, promiseExisted, promiseTag, propertyIsEnumerable, regExpTag, root, setCtorString, setExisted, setTag, stringTag, symToStringTag, symbolProto, symbolTag, symbolValueOf, toSource, weakMapCtorString, weakMapExisted, weakMapTag };
73
+ export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag, arrSlice, arrayBufferTag, arrayProto, arrayTag, blobExisted, blobTag, booleanTag, dataViewCtorString, dataViewExisted, dataViewTag, dateTag, domExceptionTag, errorTag, fileTag, functionTags, functionToString, hasOwnProperty, initSource, mapCtorString, mapExisted, mapTag, numberTag, objectCtorString, objectProto, objectTag, objectToString, promiseCtorString, promiseExisted, promiseTag, propertyIsEnumerable, regExpTag, root, setCtorString, setExisted, setTag, stringTag, symToStringTag, symbolProto, symbolTag, symbolValueOf, toSource, typedArrayTags, weakMapCtorString, weakMapExisted, weakMapTag, weakSetTag };
package/es/isArguments.js CHANGED
@@ -1,11 +1,11 @@
1
- import isType from './internals/isType.js';
2
- import { hasOwnProperty, propertyIsEnumerable } from './internals/native.js';
3
- import { supportedArgumentsType, argType } from './internals/helpers.js';
1
+ import { argumentsTag, hasOwnProperty, propertyIsEnumerable } from './internals/native.js';
2
+ import { supportedArgumentsType } from './internals/helpers.js';
4
3
  import isObjectLike from './isObjectLike.js';
4
+ import { checkType } from './internals/checkType.js';
5
5
 
6
6
  function isArguments(value) {
7
7
  if (supportedArgumentsType) {
8
- return isObjectLike(value) && isType(value, argType);
8
+ return checkType(value, argumentsTag);
9
9
  }
10
10
  return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
11
11
  }
@@ -1,9 +1,9 @@
1
- import isType from './internals/isType.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { arrayBufferTag } from './internals/native.js';
2
3
  import { nodeIsArrayBuffer } from './internals/nodeUtil.js';
3
- import isObjectLike from './isObjectLike.js';
4
4
 
5
5
  function isArrayBuffer(value) {
6
- return nodeIsArrayBuffer ? nodeIsArrayBuffer(value) : isObjectLike(value) && isType(value, 'ArrayBuffer');
6
+ return nodeIsArrayBuffer ? nodeIsArrayBuffer(value) : checkType(value, arrayBufferTag);
7
7
  }
8
8
 
9
9
  export { isArrayBuffer as default };
package/es/isBlob.js CHANGED
@@ -1,8 +1,8 @@
1
- import isType from './internals/isType.js';
2
- import { blobExisted } from './internals/native.js';
1
+ import { checkTypes } from './internals/checkType.js';
2
+ import { blobExisted, blobTag, fileTag } from './internals/native.js';
3
3
 
4
4
  function isBlob(value) {
5
- return (blobExisted && value instanceof Blob) || isType(value, ['Blob', 'File']);
5
+ return (blobExisted && value instanceof Blob) || checkTypes(value, [blobTag, fileTag]);
6
6
  }
7
7
 
8
8
  export { isBlob as default };
package/es/isBoolean.js CHANGED
@@ -1,7 +1,8 @@
1
- import isType from './internals/isType.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { booleanTag } from './internals/native.js';
2
3
 
3
4
  function isBoolean(value) {
4
- return value === true || value === false || isType(value, 'Boolean');
5
+ return value === true || value === false || checkType(value, booleanTag);
5
6
  }
6
7
 
7
8
  export { isBoolean as default };
package/es/isDataView.js CHANGED
@@ -1,7 +1,8 @@
1
- import isType from './internals/isType.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { dataViewTag } from './internals/native.js';
2
3
 
3
4
  function isDataView(value) {
4
- return isType(value, 'DataView');
5
+ return checkType(value, dataViewTag);
5
6
  }
6
7
 
7
8
  export { isDataView as default };
package/es/isDate.js CHANGED
@@ -1,9 +1,9 @@
1
- import isType from './internals/isType.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { dateTag } from './internals/native.js';
2
3
  import { nodeIsDate } from './internals/nodeUtil.js';
3
- import isObjectLike from './isObjectLike.js';
4
4
 
5
5
  function isDate(value) {
6
- return nodeIsDate ? nodeIsDate(value) : isObjectLike(value) && isType(value, 'Date');
6
+ return nodeIsDate ? nodeIsDate(value) : checkType(value, dateTag);
7
7
  }
8
8
 
9
9
  export { isDate as default };
package/es/isError.js CHANGED
@@ -1,11 +1,9 @@
1
- import isType from './internals/isType.js';
1
+ import { checkTypes } from './internals/checkType.js';
2
+ import { errorTag, domExceptionTag } from './internals/native.js';
2
3
  import isObjectLike from './isObjectLike.js';
3
4
 
4
5
  function isError(value) {
5
- if (!isObjectLike(value)) {
6
- return false;
7
- }
8
- return value instanceof Error || isType(value, ['Error', 'DOMException']);
6
+ return isObjectLike(value) && (value instanceof Error || checkTypes(value, [errorTag, domExceptionTag]));
9
7
  }
10
8
 
11
9
  export { isError as default };
package/es/isFunction.js CHANGED
@@ -1,11 +1,12 @@
1
- import isType from './internals/isType.js';
1
+ import { checkTypes } from './internals/checkType.js';
2
+ import { functionTags } from './internals/native.js';
2
3
  import isObject from './isObject.js';
3
4
 
4
5
  function isFunction(value) {
5
6
  if (!isObject(value)) {
6
7
  return false;
7
8
  }
8
- return isType(value, ['Function', 'AsyncFunction', 'GeneratorFunction', 'Proxy']);
9
+ return checkTypes(value, functionTags);
9
10
  }
10
11
 
11
12
  export { isFunction as default };
package/es/isMap.js CHANGED
@@ -1,9 +1,9 @@
1
- import isType from './internals/isType.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { mapTag } from './internals/native.js';
2
3
  import { nodeIsMap } from './internals/nodeUtil.js';
3
- import isObjectLike from './isObjectLike.js';
4
4
 
5
5
  function isMap(value) {
6
- return nodeIsMap ? nodeIsMap(value) : isObjectLike(value) && isType(value, 'Map');
6
+ return nodeIsMap ? nodeIsMap(value) : checkType(value, mapTag);
7
7
  }
8
8
 
9
9
  export { isMap as default };
package/es/isMatch.js ADDED
@@ -0,0 +1,71 @@
1
+ import allKeys from './allKeys.js';
2
+ import { checkType } from './internals/checkType.js';
3
+ import { objectTag } from './internals/native.js';
4
+ import isEqual from './isEqual.js';
5
+
6
+ function isDeepComparable(object, source) {
7
+ return checkType(object, objectTag) && checkType(source, objectTag);
8
+ }
9
+ function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack) {
10
+ var hasCustomizer = typeof customizer === 'function';
11
+ if (isDeepComparable(object, source)) {
12
+ objStack = objStack || [];
13
+ srcStack = srcStack || [];
14
+ var stackLen = objStack.length;
15
+ while (stackLen--) {
16
+ if (objStack[stackLen] === object && srcStack[stackLen] === source) {
17
+ return true;
18
+ }
19
+ }
20
+ objStack.push(object);
21
+ srcStack.push(source);
22
+ var keys = allKeys(source);
23
+ var length_1 = keys.length;
24
+ while (length_1--) {
25
+ var key = keys[length_1];
26
+ if (!(key in object)) {
27
+ return false;
28
+ }
29
+ var compared = void 0;
30
+ if (hasCustomizer) {
31
+ compared = customizer(object[key], source[key], key, object, source, objStack, srcStack);
32
+ }
33
+ if (compared !== undefined) {
34
+ if (!compared) {
35
+ return false;
36
+ }
37
+ continue;
38
+ }
39
+ if (!baseIsMatch(object[key], source[key], customizer, strictCheck, objStack, srcStack)) {
40
+ return false;
41
+ }
42
+ }
43
+ objStack.pop();
44
+ srcStack.pop();
45
+ return true;
46
+ }
47
+ var result = isEqual(object, source, function (objValue, srcValue, k, obj, src) {
48
+ if (hasCustomizer) {
49
+ var compared = customizer(objValue, srcValue, k, obj, src, objStack, srcStack);
50
+ if (compared !== undefined) {
51
+ return compared;
52
+ }
53
+ }
54
+ if (isDeepComparable(objValue, srcValue)) {
55
+ return baseIsMatch(objValue, srcValue, customizer, strictCheck, objStack, srcStack);
56
+ }
57
+ }, strictCheck);
58
+ return result;
59
+ }
60
+ function isMatch(object, source, customizer, strictCheck) {
61
+ if (strictCheck === void 0) { strictCheck = false; }
62
+ if (typeof customizer === 'function' && isDeepComparable(object, source)) {
63
+ var compared = customizer(object, source);
64
+ if (compared !== undefined) {
65
+ return !!compared;
66
+ }
67
+ }
68
+ return baseIsMatch(object, source, customizer, strictCheck);
69
+ }
70
+
71
+ export { isMatch as default };
package/es/isNumber.js CHANGED
@@ -1,8 +1,8 @@
1
- import isType from './internals/isType.js';
2
- import isObjectLike from './isObjectLike.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { numberTag } from './internals/native.js';
3
3
 
4
4
  function isNumber(value) {
5
- return typeof value === 'number' || (isObjectLike(value) && isType(value, 'Number'));
5
+ return typeof value === 'number' || checkType(value, numberTag);
6
6
  }
7
7
 
8
8
  export { isNumber as default };
@@ -1,9 +1,9 @@
1
- import { hasOwnProperty, functionToString, objectCtorString } from './internals/native.js';
2
- import isType from './internals/isType.js';
1
+ import { objectTag, hasOwnProperty, functionToString, objectCtorString } from './internals/native.js';
2
+ import { checkType } from './internals/checkType.js';
3
3
  import isObjectLike from './isObjectLike.js';
4
4
 
5
5
  function isPlainObject(value) {
6
- if (!isObjectLike(value) || !isType(value, 'Object')) {
6
+ if (!isObjectLike(value) || !checkType(value, objectTag)) {
7
7
  return false;
8
8
  }
9
9
  var proto = Object.getPrototypeOf(Object(value));
package/es/isRegExp.js CHANGED
@@ -1,9 +1,9 @@
1
- import isType from './internals/isType.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { regExpTag } from './internals/native.js';
2
3
  import { nodeIsRegExp } from './internals/nodeUtil.js';
3
- import isObjectLike from './isObjectLike.js';
4
4
 
5
5
  function isRegExp(value) {
6
- return nodeIsRegExp ? nodeIsRegExp(value) : isObjectLike(value) && isType(value, 'RegExp');
6
+ return nodeIsRegExp ? nodeIsRegExp(value) : checkType(value, regExpTag);
7
7
  }
8
8
 
9
9
  export { isRegExp as default };
package/es/isSet.js CHANGED
@@ -1,9 +1,9 @@
1
- import isType from './internals/isType.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { setTag } from './internals/native.js';
2
3
  import { nodeIsSet } from './internals/nodeUtil.js';
3
- import isObjectLike from './isObjectLike.js';
4
4
 
5
5
  function isSet(value) {
6
- return nodeIsSet ? nodeIsSet(value) : isObjectLike(value) && isType(value, 'Set');
6
+ return nodeIsSet ? nodeIsSet(value) : checkType(value, setTag);
7
7
  }
8
8
 
9
9
  export { isSet as default };
package/es/isString.js CHANGED
@@ -1,8 +1,8 @@
1
- import isType from './internals/isType.js';
2
- import isObjectLike from './isObjectLike.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { stringTag } from './internals/native.js';
3
3
 
4
4
  function isString(value) {
5
- return typeof value === 'string' || (isObjectLike(value) && isType(value, 'String'));
5
+ return typeof value === 'string' || checkType(value, stringTag);
6
6
  }
7
7
 
8
8
  export { isString as default };
package/es/isSymbol.js CHANGED
@@ -1,8 +1,8 @@
1
- import isType from './internals/isType.js';
2
- import isObjectLike from './isObjectLike.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { symbolTag } from './internals/native.js';
3
3
 
4
4
  function isSymbol(value) {
5
- return typeof value === 'symbol' || (isObjectLike(value) && isType(value, 'Symbol'));
5
+ return typeof value === 'symbol' || checkType(value, symbolTag);
6
6
  }
7
7
 
8
8
  export { isSymbol as default };
@@ -1,4 +1,5 @@
1
- import isType from './internals/isType.js';
1
+ import { checkTypes } from './internals/checkType.js';
2
+ import { typedArrayTags } from './internals/native.js';
2
3
  import { nodeIsTypedArray } from './internals/nodeUtil.js';
3
4
  import isLength from './isLength.js';
4
5
  import isObjectLike from './isObjectLike.js';
@@ -7,7 +8,7 @@ function isTypedArray(value) {
7
8
  if (nodeIsTypedArray) {
8
9
  return nodeIsTypedArray(value);
9
10
  }
10
- return isObjectLike(value) && isLength(value.length) && isType(value, ['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array']);
11
+ return isObjectLike(value) && isLength(value.length) && checkTypes(value, typedArrayTags);
11
12
  }
12
13
 
13
14
  export { isTypedArray as default };
package/es/isWeakMap.js CHANGED
@@ -1,8 +1,8 @@
1
- import isType from './internals/isType.js';
2
- import isObjectLike from './isObjectLike.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { weakMapTag } from './internals/native.js';
3
3
 
4
4
  function isWeakMap(value) {
5
- return isObjectLike(value) && isType(value, 'WeakMap');
5
+ return checkType(value, weakMapTag);
6
6
  }
7
7
 
8
8
  export { isWeakMap as default };
package/es/isWeakSet.js CHANGED
@@ -1,8 +1,8 @@
1
- import isType from './internals/isType.js';
2
- import isObjectLike from './isObjectLike.js';
1
+ import { checkType } from './internals/checkType.js';
2
+ import { weakSetTag } from './internals/native.js';
3
3
 
4
4
  function isWeakSet(value) {
5
- return isObjectLike(value) && isType(value, 'WeakSet');
5
+ return checkType(value, weakSetTag);
6
6
  }
7
7
 
8
8
  export { isWeakSet as default };
package/lib/index.js CHANGED
@@ -44,6 +44,7 @@ var isFunction = require('./isFunction.js');
44
44
  var isInteger = require('./isInteger.js');
45
45
  var isLength = require('./isLength.js');
46
46
  var isMap = require('./isMap.js');
47
+ var isMatch = require('./isMatch.js');
47
48
  var isNaN = require('./isNaN.js');
48
49
  var isNil = require('./isNil.js');
49
50
  var isNull = require('./isNull.js');
@@ -161,6 +162,7 @@ exports.isFunction = isFunction;
161
162
  exports.isInteger = isInteger;
162
163
  exports.isLength = isLength;
163
164
  exports.isMap = isMap;
165
+ exports.isMatch = isMatch;
164
166
  exports.isNaN = isNaN;
165
167
  exports.isNil = isNil;
166
168
  exports.isNull = isNull;
@@ -0,0 +1,14 @@
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;
@@ -1,14 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./isType.js');
3
+ var checkType = require('./checkType.js');
4
4
  var native = require('./native.js');
5
5
 
6
- exports.argType = 'Arguments';
7
- exports.supportedArgumentsType = isType((function () { return arguments; })(), exports.argType);
6
+ exports.supportedArgumentsType = checkType.checkType((function () { return arguments; })(), native.argumentsTag);
8
7
  exports.FUNC_ERROR_TEXT = 'Expected a function';
9
8
  exports.numberIsFinite = Number.isFinite;
10
9
  exports.numberIsInteger = Number.isInteger;
11
10
  exports.numberIsSafeInteger = Number.isSafeInteger;
12
11
  exports.objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
13
12
  exports.arrayAt = native.arrayProto.at;
14
- exports.VERSION = "1.3.2";
13
+ exports.VERSION = "1.4.0";
@@ -35,6 +35,9 @@ function toSource(func) {
35
35
  }
36
36
  return '';
37
37
  }
38
+ function wrapTags(tags) {
39
+ return tags.map(function (item) { return '[object ' + item + ']'; });
40
+ }
38
41
  exports.numberTag = '[object Number]';
39
42
  exports.booleanTag = '[object Boolean]';
40
43
  exports.stringTag = '[object String]';
@@ -45,6 +48,12 @@ exports.errorTag = '[object Error]';
45
48
  exports.arrayBufferTag = '[object ArrayBuffer]';
46
49
  exports.argumentsTag = '[object Arguments]';
47
50
  exports.arrayTag = '[object Array]';
51
+ exports.typedArrayTags = wrapTags(['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array']);
52
+ exports.functionTags = wrapTags(['Function', 'AsyncFunction', 'GeneratorFunction', 'Proxy']);
53
+ exports.weakSetTag = '[object WeakSet]';
54
+ exports.blobTag = '[object Blob]';
55
+ exports.fileTag = '[object Blob]';
56
+ exports.domExceptionTag = '[object DOMException]';
48
57
  exports.objectTag = '[object Object]';
49
58
  exports.dataViewTag = '[object DataView]';
50
59
  exports.mapTag = '[object Map]';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
4
3
  var native = require('./internals/native.js');
5
4
  var helpers = require('./internals/helpers.js');
6
5
  var isObjectLike = require('./isObjectLike.js');
6
+ var checkType = require('./internals/checkType.js');
7
7
 
8
8
  function isArguments(value) {
9
9
  if (helpers.supportedArgumentsType) {
10
- return isObjectLike(value) && isType(value, helpers.argType);
10
+ return checkType.checkType(value, native.argumentsTag);
11
11
  }
12
12
  return isObjectLike(value) && native.hasOwnProperty.call(value, 'callee') && !native.propertyIsEnumerable.call(value, 'callee');
13
13
  }
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
+ var native = require('./internals/native.js');
4
5
  var nodeUtil = require('./internals/nodeUtil.js');
5
- var isObjectLike = require('./isObjectLike.js');
6
6
 
7
7
  function isArrayBuffer(value) {
8
- return nodeUtil.nodeIsArrayBuffer ? nodeUtil.nodeIsArrayBuffer(value) : isObjectLike(value) && isType(value, 'ArrayBuffer');
8
+ return nodeUtil.nodeIsArrayBuffer ? nodeUtil.nodeIsArrayBuffer(value) : checkType.checkType(value, native.arrayBufferTag);
9
9
  }
10
10
 
11
11
  module.exports = isArrayBuffer;
package/lib/isBlob.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
4
  var native = require('./internals/native.js');
5
5
 
6
6
  function isBlob(value) {
7
- return (native.blobExisted && value instanceof Blob) || isType(value, ['Blob', 'File']);
7
+ return (native.blobExisted && value instanceof Blob) || checkType.checkTypes(value, [native.blobTag, native.fileTag]);
8
8
  }
9
9
 
10
10
  module.exports = isBlob;
package/lib/isBoolean.js CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
+ var native = require('./internals/native.js');
4
5
 
5
6
  function isBoolean(value) {
6
- return value === true || value === false || isType(value, 'Boolean');
7
+ return value === true || value === false || checkType.checkType(value, native.booleanTag);
7
8
  }
8
9
 
9
10
  module.exports = isBoolean;
package/lib/isDataView.js CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
+ var native = require('./internals/native.js');
4
5
 
5
6
  function isDataView(value) {
6
- return isType(value, 'DataView');
7
+ return checkType.checkType(value, native.dataViewTag);
7
8
  }
8
9
 
9
10
  module.exports = isDataView;
package/lib/isDate.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
+ var native = require('./internals/native.js');
4
5
  var nodeUtil = require('./internals/nodeUtil.js');
5
- var isObjectLike = require('./isObjectLike.js');
6
6
 
7
7
  function isDate(value) {
8
- return nodeUtil.nodeIsDate ? nodeUtil.nodeIsDate(value) : isObjectLike(value) && isType(value, 'Date');
8
+ return nodeUtil.nodeIsDate ? nodeUtil.nodeIsDate(value) : checkType.checkType(value, native.dateTag);
9
9
  }
10
10
 
11
11
  module.exports = isDate;
package/lib/isError.js CHANGED
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
+ var native = require('./internals/native.js');
4
5
  var isObjectLike = require('./isObjectLike.js');
5
6
 
6
7
  function isError(value) {
7
- if (!isObjectLike(value)) {
8
- return false;
9
- }
10
- return value instanceof Error || isType(value, ['Error', 'DOMException']);
8
+ return isObjectLike(value) && (value instanceof Error || checkType.checkTypes(value, [native.errorTag, native.domExceptionTag]));
11
9
  }
12
10
 
13
11
  module.exports = isError;
package/lib/isFunction.js CHANGED
@@ -1,13 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
+ var native = require('./internals/native.js');
4
5
  var isObject = require('./isObject.js');
5
6
 
6
7
  function isFunction(value) {
7
8
  if (!isObject(value)) {
8
9
  return false;
9
10
  }
10
- return isType(value, ['Function', 'AsyncFunction', 'GeneratorFunction', 'Proxy']);
11
+ return checkType.checkTypes(value, native.functionTags);
11
12
  }
12
13
 
13
14
  module.exports = isFunction;
package/lib/isMap.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var isType = require('./internals/isType.js');
3
+ var checkType = require('./internals/checkType.js');
4
+ var native = require('./internals/native.js');
4
5
  var nodeUtil = require('./internals/nodeUtil.js');
5
- var isObjectLike = require('./isObjectLike.js');
6
6
 
7
7
  function isMap(value) {
8
- return nodeUtil.nodeIsMap ? nodeUtil.nodeIsMap(value) : isObjectLike(value) && isType(value, 'Map');
8
+ return nodeUtil.nodeIsMap ? nodeUtil.nodeIsMap(value) : checkType.checkType(value, native.mapTag);
9
9
  }
10
10
 
11
11
  module.exports = isMap;