mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Assume ES5+ built-ins exist.
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
const DataView = getNative(root, 'DataView');
|
|
||||||
|
|
||||||
export default DataView;
|
|
||||||
6
_Map.js
6
_Map.js
@@ -1,6 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
const Map = getNative(root, 'Map');
|
|
||||||
|
|
||||||
export default Map;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
const Promise = getNative(root, 'Promise');
|
|
||||||
|
|
||||||
export default Promise;
|
|
||||||
6
_Set.js
6
_Set.js
@@ -1,6 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
const Set = getNative(root, 'Set');
|
|
||||||
|
|
||||||
export default Set;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
export default root.Symbol;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
export default root.Uint8Array;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
const WeakMap = getNative(root, 'WeakMap');
|
|
||||||
|
|
||||||
export default WeakMap;
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import defineProperty from './_defineProperty.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `assignValue` and `assignMergeValue` without
|
* The base implementation of `assignValue` and `assignMergeValue` without
|
||||||
* value checks.
|
* value checks.
|
||||||
@@ -10,8 +8,8 @@ import defineProperty from './_defineProperty.js';
|
|||||||
* @param {*} value The value to assign.
|
* @param {*} value The value to assign.
|
||||||
*/
|
*/
|
||||||
function baseAssignValue(object, key, value) {
|
function baseAssignValue(object, key, value) {
|
||||||
if (key == '__proto__' && defineProperty) {
|
if (key == '__proto__') {
|
||||||
defineProperty(object, key, {
|
Object.defineProperty(object, key, {
|
||||||
'configurable': true,
|
'configurable': true,
|
||||||
'enumerable': true,
|
'enumerable': true,
|
||||||
'value': value,
|
'value': value,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import Symbol from './_Symbol.js';
|
|
||||||
import getRawTag from './_getRawTag.js';
|
import getRawTag from './_getRawTag.js';
|
||||||
import objectToString from './_objectToString.js';
|
import objectToString from './_objectToString.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import constant from './constant.js';
|
import constant from './constant.js';
|
||||||
import defineProperty from './_defineProperty.js';
|
|
||||||
import identity from './identity.js';
|
import identity from './identity.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,11 +9,13 @@ import identity from './identity.js';
|
|||||||
* @param {Function} string The `toString` result.
|
* @param {Function} string The `toString` result.
|
||||||
* @returns {Function} Returns `func`.
|
* @returns {Function} Returns `func`.
|
||||||
*/
|
*/
|
||||||
const baseSetToString = !defineProperty ? identity : (func, string) => defineProperty(func, 'toString', {
|
function baseSetToString(func, string){
|
||||||
'configurable': true,
|
return Object.defineProperty(func, 'toString', {
|
||||||
'enumerable': false,
|
'configurable': true,
|
||||||
'value': constant(string),
|
'enumerable': false,
|
||||||
'writable': true
|
'value': constant(string),
|
||||||
});
|
'writable': true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default baseSetToString;
|
export default baseSetToString;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import Symbol from './_Symbol.js';
|
|
||||||
import arrayMap from './_arrayMap.js';
|
import arrayMap from './_arrayMap.js';
|
||||||
import isSymbol from './isSymbol.js';
|
import isSymbol from './isSymbol.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import Uint8Array from './_Uint8Array.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a clone of `arrayBuffer`.
|
* Creates a clone of `arrayBuffer`.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import Symbol from './_Symbol.js';
|
|
||||||
|
|
||||||
/** Used to convert symbols to primitives and strings. */
|
/** Used to convert symbols to primitives and strings. */
|
||||||
const symbolProto = Symbol ? Symbol.prototype : undefined;
|
const symbolValueOf = Symbol.prototype.valueOf;
|
||||||
const symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a clone of the `symbol` object.
|
* Creates a clone of the `symbol` object.
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import Set from './_Set.js';
|
|
||||||
import setToArray from './_setToArray.js';
|
import setToArray from './_setToArray.js';
|
||||||
|
|
||||||
/** Used as references for various `Number` constants. */
|
/** Used as references for various `Number` constants. */
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
|
|
||||||
const defineProperty = ((() => {
|
|
||||||
try {
|
|
||||||
const func = getNative(Object, 'defineProperty');
|
|
||||||
func({}, '', {});
|
|
||||||
return func;
|
|
||||||
} catch (e) {}
|
|
||||||
})());
|
|
||||||
|
|
||||||
export default defineProperty;
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import Symbol from './_Symbol.js';
|
|
||||||
import Uint8Array from './_Uint8Array.js';
|
|
||||||
import eq from './eq.js';
|
import eq from './eq.js';
|
||||||
import equalArrays from './_equalArrays.js';
|
import equalArrays from './_equalArrays.js';
|
||||||
import mapToArray from './_mapToArray.js';
|
import mapToArray from './_mapToArray.js';
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import isNative from './isNative.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the native function at `key` of `object`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to query.
|
|
||||||
* @param {string} key The key of the method to get.
|
|
||||||
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
||||||
*/
|
|
||||||
function getNative(object, key) {
|
|
||||||
const value = object == null ? undefined : object[key];
|
|
||||||
return isNative(value) ? value : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default getNative;
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import Symbol from './_Symbol.js';
|
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
const objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
|
|||||||
13
_getTag.js
13
_getTag.js
@@ -1,8 +1,3 @@
|
|||||||
import DataView from './_DataView.js';
|
|
||||||
import Map from './_Map.js';
|
|
||||||
import Promise from './_Promise.js';
|
|
||||||
import Set from './_Set.js';
|
|
||||||
import WeakMap from './_WeakMap.js';
|
|
||||||
import baseGetTag from './_baseGetTag.js';
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import toSource from './_toSource.js';
|
import toSource from './_toSource.js';
|
||||||
|
|
||||||
@@ -32,10 +27,10 @@ let getTag = baseGetTag;
|
|||||||
|
|
||||||
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
||||||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||||
(Map && getTag(new Map) != mapTag) ||
|
(getTag(new Map) != mapTag) ||
|
||||||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
(getTag(Promise.resolve()) != promiseTag) ||
|
||||||
(Set && getTag(new Set) != setTag) ||
|
(getTag(new Set) != setTag) ||
|
||||||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
(getTag(new WeakMap) != weakMapTag)) {
|
||||||
getTag = value => {
|
getTag = value => {
|
||||||
const result = baseGetTag(value);
|
const result = baseGetTag(value);
|
||||||
const Ctor = result == objectTag ? value.constructor : undefined;
|
const Ctor = result == objectTag ? value.constructor : undefined;
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import Symbol from './_Symbol.js';
|
|
||||||
import isArguments from './isArguments.js';
|
import isArguments from './isArguments.js';
|
||||||
|
|
||||||
/** Built-in value references. */
|
|
||||||
const spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is a flattenable `arguments` object or array.
|
* Checks if `value` is a flattenable `arguments` object or array.
|
||||||
*
|
*
|
||||||
@@ -13,7 +9,7 @@ const spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
|||||||
*/
|
*/
|
||||||
function isFlattenable(value) {
|
function isFlattenable(value) {
|
||||||
return Array.isArray(value) || isArguments(value) ||
|
return Array.isArray(value) || isArguments(value) ||
|
||||||
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
!!(Symbol.isConcatSpreadable && value && value[spreadableSymbol]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isFlattenable;
|
export default isFlattenable;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import Hash from './_Hash.js';
|
import Hash from './_Hash.js';
|
||||||
import ListCache from './_ListCache.js';
|
import ListCache from './_ListCache.js';
|
||||||
import Map from './_Map.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all key-value entries from the map.
|
* Removes all key-value entries from the map.
|
||||||
|
|||||||
@@ -1,6 +1 @@
|
|||||||
import WeakMap from './_WeakMap.js';
|
export default new WeakMap;
|
||||||
|
|
||||||
/** Used to store function metadata. */
|
|
||||||
const metaMap = WeakMap && new WeakMap;
|
|
||||||
|
|
||||||
export default metaMap;
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
|
|
||||||
/* Built-in method references that are verified to be native. */
|
|
||||||
const nativeCreate = getNative(Object, 'create');
|
|
||||||
|
|
||||||
export default nativeCreate;
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import ListCache from './_ListCache.js';
|
import ListCache from './_ListCache.js';
|
||||||
import Map from './_Map.js';
|
|
||||||
import MapCache from './_MapCache.js';
|
import MapCache from './_MapCache.js';
|
||||||
|
|
||||||
/** Used as the size to enable large array optimizations. */
|
/** Used as the size to enable large array optimizations. */
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const reIsNative = RegExp(`^${
|
|||||||
* isNative(Array.prototype.push);
|
* isNative(Array.prototype.push);
|
||||||
* // => true
|
* // => true
|
||||||
*
|
*
|
||||||
* isNative(_);
|
* isNative(isDate);
|
||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isNative(value) {
|
function isNative(value) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import Symbol from './_Symbol.js';
|
|
||||||
import copyArray from './_copyArray.js';
|
import copyArray from './_copyArray.js';
|
||||||
import getTag from './_getTag.js';
|
import getTag from './_getTag.js';
|
||||||
import isArrayLike from './isArrayLike.js';
|
import isArrayLike from './isArrayLike.js';
|
||||||
|
|||||||
Reference in New Issue
Block a user