ut2 1.4.7 → 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,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
  }
@@ -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/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.7";
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
  }
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ut2",
3
- "version": "1.4.7",
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;