ut2 1.4.6 → 1.4.8

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.
@@ -1,9 +1,9 @@
1
1
  import isPrototype from './isPrototype.js';
2
- import { hasOwnProperty } from './native.js';
2
+ import { objectKeys, hasOwnProperty } from './native.js';
3
3
 
4
4
  function keys(value) {
5
5
  if (!isPrototype(value)) {
6
- return Object.keys(value);
6
+ return objectKeys(value);
7
7
  }
8
8
  var result = [];
9
9
  for (var key in Object(value)) {
@@ -1,13 +1,16 @@
1
1
  var objectProto = Object.prototype;
2
2
  var objectToString = objectProto.toString;
3
3
  var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
4
+ var objectGetPrototypeOf = Object.getPrototypeOf;
5
+ var objectKeys = Object.keys;
4
6
  var hasOwnProperty = objectProto.hasOwnProperty;
5
7
  var propertyIsEnumerable = objectProto.propertyIsEnumerable;
6
8
  var functionToString = Function.prototype.toString;
7
- var symbolProto = Symbol ? Symbol.prototype : undefined;
8
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
9
+ var symbolExisted = typeof Symbol !== 'undefined';
10
+ var symbolProto = symbolExisted ? Symbol.prototype : undefined;
11
+ var symToStringTag = symbolExisted ? Symbol.toStringTag : undefined;
9
12
  var arrayProto = Array.prototype;
10
- var arrSlice = Array.prototype.slice;
13
+ var arrSlice = arrayProto.slice;
11
14
  var arrayAt = arrayProto.at;
12
15
  var numberIsFinite = Number.isFinite;
13
16
  var numberIsInteger = Number.isInteger;
@@ -37,4 +40,4 @@ var promiseTag = '[object Promise]';
37
40
  var setTag = '[object Set]';
38
41
  var weakMapTag = '[object WeakMap]';
39
42
 
40
- export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag, arrSlice, arrayAt, arrayBufferTag, arrayProto, arrayTag, blobTag, booleanTag, dataViewTag, dateTag, domExceptionTag, errorTag, functionTags, functionToString, hasOwnProperty, mapTag, numberIsFinite, numberIsInteger, numberIsSafeInteger, numberTag, objectGetOwnPropertySymbols, objectProto, objectTag, objectToString, promiseTag, propertyIsEnumerable, regExpTag, setTag, stringTag, symToStringTag, symbolProto, symbolTag, typedArrayTags, weakMapTag, weakSetTag };
43
+ export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag, arrSlice, arrayAt, arrayBufferTag, arrayProto, arrayTag, blobTag, booleanTag, dataViewTag, dateTag, domExceptionTag, errorTag, functionTags, functionToString, hasOwnProperty, mapTag, numberIsFinite, numberIsInteger, numberIsSafeInteger, numberTag, objectGetOwnPropertySymbols, objectGetPrototypeOf, objectKeys, objectProto, objectTag, objectToString, promiseTag, propertyIsEnumerable, regExpTag, setTag, stringTag, symToStringTag, symbolProto, symbolTag, typedArrayTags, weakMapTag, weakSetTag };
package/es/isBuffer.js CHANGED
@@ -1,6 +1,9 @@
1
1
  function isBuffer(value) {
2
- if (typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function') {
3
- return Buffer.isBuffer(value);
2
+ if (typeof Buffer === 'function') {
3
+ var isBuffer_1 = Buffer.isBuffer;
4
+ if (typeof isBuffer_1 === 'function') {
5
+ return isBuffer_1(value);
6
+ }
4
7
  }
5
8
  return false;
6
9
  }
package/es/isEqual.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import allKeys from './allKeys.js';
2
2
  import eq from './eq.js';
3
3
  import getTagWithBugfix from './internals/getTagWithBugfix.js';
4
- import { arrayBufferTag, dataViewTag, errorTag, symbolTag, regExpTag, stringTag, dateTag, booleanTag, numberTag, objectTag, hasOwnProperty, argumentsTag, setTag, mapTag, arrayTag, arrSlice } from './internals/native.js';
5
- import symbolValueOf from './internals/symbolValueOf.js';
4
+ import { symbolProto, arrayBufferTag, dataViewTag, errorTag, symbolTag, regExpTag, stringTag, dateTag, booleanTag, numberTag, objectTag, hasOwnProperty, argumentsTag, setTag, mapTag, arrayTag, arrSlice } from './internals/native.js';
6
5
  import isBuffer from './isBuffer.js';
7
6
  import isFunction from './isFunction.js';
8
7
  import isNil from './isNil.js';
@@ -10,6 +9,7 @@ import isObjectLike from './isObjectLike.js';
10
9
  import isTypedArray from './isTypedArray.js';
11
10
  import orderBy from './orderBy.js';
12
11
 
12
+ var symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
13
13
  function mapToArray(map) {
14
14
  var result = [];
15
15
  map.forEach(function (value, key) {
@@ -1,5 +1,5 @@
1
1
  import getTag from './internals/getTag.js';
2
- import { functionToString, objectTag, hasOwnProperty } from './internals/native.js';
2
+ import { functionToString, objectTag, objectGetPrototypeOf, hasOwnProperty } from './internals/native.js';
3
3
  import isObjectLike from './isObjectLike.js';
4
4
 
5
5
  var objectCtorString = functionToString.call(Object);
@@ -7,7 +7,7 @@ function isPlainObject(value) {
7
7
  if (!isObjectLike(value) || getTag(value) !== objectTag) {
8
8
  return false;
9
9
  }
10
- var proto = Object.getPrototypeOf(Object(value));
10
+ var proto = objectGetPrototypeOf(Object(value));
11
11
  if (proto === null) {
12
12
  return true;
13
13
  }
package/es/toString.js CHANGED
@@ -1,7 +1,8 @@
1
- import symbolToString from './internals/symbolToString.js';
1
+ import { symbolProto } from './internals/native.js';
2
2
  import isArray from './isArray.js';
3
3
  import isSymbol from './isSymbol.js';
4
4
 
5
+ var symbolToString = symbolProto ? symbolProto.toString : undefined;
5
6
  function baseToString(value) {
6
7
  if (typeof value === 'string') {
7
8
  return value;
package/lib/allKeys.js CHANGED
@@ -1,13 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var getSymbols = require('./internals/getSymbols.js');
4
+ var native = require('./internals/native.js');
4
5
  var isObject = require('./isObject.js');
5
6
 
6
7
  function allKeys(object) {
7
8
  if (!isObject(object)) {
8
9
  return [];
9
10
  }
10
- return Object.keys(object).concat(getSymbols(object));
11
+ return native.objectKeys(object).concat(getSymbols(object));
11
12
  }
12
13
 
13
14
  module.exports = allKeys;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var getSymbols = require('./getSymbols.js');
4
+ var native = require('./native.js');
4
5
 
5
6
  function getSymbolsIn(object) {
6
7
  var result = [];
@@ -11,7 +12,7 @@ function getSymbolsIn(object) {
11
12
  result.push(item);
12
13
  }
13
14
  });
14
- o = Object.getPrototypeOf(o);
15
+ o = native.objectGetPrototypeOf(o);
15
16
  }
16
17
  return result;
17
18
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  var native = require('./native.js');
4
4
 
5
- exports.VERSION = "1.4.6";
5
+ exports.VERSION = "1.4.8";
6
6
  exports.supportedArgumentsType = native.objectToString.call((function () { return arguments; })()) === native.argumentsTag;
7
7
  exports.FUNC_ERROR_TEXT = 'Expected a function';
8
8
  function toSource(func) {
@@ -5,7 +5,7 @@ var native = require('./native.js');
5
5
 
6
6
  function keys(value) {
7
7
  if (!isPrototype(value)) {
8
- return Object.keys(value);
8
+ return native.objectKeys(value);
9
9
  }
10
10
  var result = [];
11
11
  for (var key in Object(value)) {
@@ -3,13 +3,16 @@
3
3
  exports.objectProto = Object.prototype;
4
4
  exports.objectToString = exports.objectProto.toString;
5
5
  exports.objectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
6
+ exports.objectGetPrototypeOf = Object.getPrototypeOf;
7
+ exports.objectKeys = Object.keys;
6
8
  exports.hasOwnProperty = exports.objectProto.hasOwnProperty;
7
9
  exports.propertyIsEnumerable = exports.objectProto.propertyIsEnumerable;
8
10
  exports.functionToString = Function.prototype.toString;
9
- exports.symbolProto = Symbol ? Symbol.prototype : undefined;
10
- exports.symToStringTag = Symbol ? Symbol.toStringTag : undefined;
11
+ var symbolExisted = typeof Symbol !== 'undefined';
12
+ exports.symbolProto = symbolExisted ? Symbol.prototype : undefined;
13
+ exports.symToStringTag = symbolExisted ? Symbol.toStringTag : undefined;
11
14
  exports.arrayProto = Array.prototype;
12
- exports.arrSlice = Array.prototype.slice;
15
+ exports.arrSlice = exports.arrayProto.slice;
13
16
  exports.arrayAt = exports.arrayProto.at;
14
17
  exports.numberIsFinite = Number.isFinite;
15
18
  exports.numberIsInteger = Number.isInteger;
package/lib/isBuffer.js CHANGED
@@ -1,8 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  function isBuffer(value) {
4
- if (typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function') {
5
- return Buffer.isBuffer(value);
4
+ if (typeof Buffer === 'function') {
5
+ var isBuffer_1 = Buffer.isBuffer;
6
+ if (typeof isBuffer_1 === 'function') {
7
+ return isBuffer_1(value);
8
+ }
6
9
  }
7
10
  return false;
8
11
  }
package/lib/isEqual.js CHANGED
@@ -4,7 +4,6 @@ var allKeys = require('./allKeys.js');
4
4
  var eq = require('./eq.js');
5
5
  var getTagWithBugfix = require('./internals/getTagWithBugfix.js');
6
6
  var native = require('./internals/native.js');
7
- var symbolValueOf = require('./internals/symbolValueOf.js');
8
7
  var isBuffer = require('./isBuffer.js');
9
8
  var isFunction = require('./isFunction.js');
10
9
  var isNil = require('./isNil.js');
@@ -12,6 +11,7 @@ var isObjectLike = require('./isObjectLike.js');
12
11
  var isTypedArray = require('./isTypedArray.js');
13
12
  var orderBy = require('./orderBy.js');
14
13
 
14
+ var symbolValueOf = native.symbolProto ? native.symbolProto.valueOf : undefined;
15
15
  function mapToArray(map) {
16
16
  var result = [];
17
17
  map.forEach(function (value, key) {
@@ -9,7 +9,7 @@ function isPlainObject(value) {
9
9
  if (!isObjectLike(value) || getTag(value) !== native.objectTag) {
10
10
  return false;
11
11
  }
12
- var proto = Object.getPrototypeOf(Object(value));
12
+ var proto = native.objectGetPrototypeOf(Object(value));
13
13
  if (proto === null) {
14
14
  return true;
15
15
  }
package/lib/toString.js CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var symbolToString = require('./internals/symbolToString.js');
3
+ var native = require('./internals/native.js');
4
4
  var isArray = require('./isArray.js');
5
5
  var isSymbol = require('./isSymbol.js');
6
6
 
7
+ var symbolToString = native.symbolProto ? native.symbolProto.toString : undefined;
7
8
  function baseToString(value) {
8
9
  if (typeof value === 'string') {
9
10
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ut2",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "author": "caijf",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -1,6 +1,11 @@
1
1
  export declare const objectProto: Object;
2
2
  export declare const objectToString: () => string;
3
3
  export declare const objectGetOwnPropertySymbols: (o: any) => symbol[];
4
+ export declare const objectGetPrototypeOf: (o: any) => any;
5
+ export declare const objectKeys: {
6
+ (o: object): string[];
7
+ (o: {}): string[];
8
+ };
4
9
  export declare const hasOwnProperty: (v: PropertyKey) => boolean;
5
10
  export declare const propertyIsEnumerable: (v: PropertyKey) => boolean;
6
11
  export declare const functionToString: () => string;
@@ -1,5 +0,0 @@
1
- import { symbolProto } from './native.js';
2
-
3
- var symbolToString = symbolProto ? symbolProto.toString : undefined;
4
-
5
- export { symbolToString as default };
@@ -1,5 +0,0 @@
1
- import { symbolProto } from './native.js';
2
-
3
- var symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
4
-
5
- export { symbolValueOf as default };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- var native = require('./native.js');
4
-
5
- var symbolToString = native.symbolProto ? native.symbolProto.toString : undefined;
6
-
7
- module.exports = symbolToString;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- var native = require('./native.js');
4
-
5
- var symbolValueOf = native.symbolProto ? native.symbolProto.valueOf : undefined;
6
-
7
- module.exports = symbolValueOf;
@@ -1,2 +0,0 @@
1
- declare const _default: (() => string) | undefined;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: (() => symbol) | undefined;
2
- export default _default;