mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Consolidate prototype vars used only once.
This commit is contained in:
@@ -5,11 +5,8 @@ import isBuffer from './isBuffer.js';
|
||||
import isIndex from './_isIndex.js';
|
||||
import isTypedArray from './isTypedArray.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates an array of the enumerable property names of the array-like `value`.
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import baseAssignValue from './_baseAssignValue.js';
|
||||
import eq from './eq.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `has` without support for deep paths.
|
||||
|
||||
@@ -15,11 +15,8 @@ const argsTag = '[object Arguments]';
|
||||
const arrayTag = '[object Array]';
|
||||
const objectTag = '[object Object]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import isPrototype from './_isPrototype.js';
|
||||
import nativeKeys from './_nativeKeys.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `keys` which doesn't treat sparse arrays as dense.
|
||||
|
||||
@@ -2,11 +2,8 @@ import isObject from './isObject.js';
|
||||
import isPrototype from './_isPrototype.js';
|
||||
import nativeKeysIn from './_nativeKeysIn.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `keysIn` which doesn't treat sparse arrays as dense.
|
||||
|
||||
@@ -3,11 +3,8 @@ import baseIndexOf from './_baseIndexOf.js';
|
||||
import baseIndexOfWith from './_baseIndexOfWith.js';
|
||||
import copyArray from './_copyArray.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const arrayProto = Array.prototype;
|
||||
|
||||
/** Built-in value references. */
|
||||
const splice = arrayProto.splice;
|
||||
const splice = Array.prototype.splice;
|
||||
|
||||
/**
|
||||
* The base implementation of `pullAllBy`.
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import baseUnset from './_baseUnset.js';
|
||||
import isIndex from './_isIndex.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const arrayProto = Array.prototype;
|
||||
|
||||
/** Built-in value references. */
|
||||
const splice = arrayProto.splice;
|
||||
const splice = Array.prototype.splice;
|
||||
|
||||
/**
|
||||
* The base implementation of `pullAt` without support for individual
|
||||
|
||||
@@ -3,11 +3,8 @@ import getAllKeys from './_getAllKeys.js';
|
||||
/** Used to compose bitmasks for value comparisons. */
|
||||
const COMPARE_PARTIAL_FLAG = 1;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* A specialized version of `baseIsEqualDeep` for objects with support for
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import realNames from './_realNames.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Gets the name of `func`.
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import arrayFilter from './_arrayFilter.js';
|
||||
import stubArray from './stubArray.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Built-in value references. */
|
||||
const propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||
const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
const nativeGetSymbols = Object.getOwnPropertySymbols;
|
||||
|
||||
@@ -3,11 +3,8 @@ import nativeCreate from './_nativeCreate.js';
|
||||
/** Used to stand-in for `undefined` hash values. */
|
||||
const HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Gets the hash value for `key`.
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import nativeCreate from './_nativeCreate.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Checks if a hash value for `key` exists.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Initializes an array clone.
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import assocIndexOf from './_assocIndexOf.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const arrayProto = Array.prototype;
|
||||
|
||||
/** Built-in value references. */
|
||||
const splice = arrayProto.splice;
|
||||
const splice = Array.prototype.splice;
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the list cache.
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
const nativeObjectToString = objectProto.toString;
|
||||
const nativeObjectToString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Converts `value` to a string using `Object.prototype.toString`.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/** Used for built-in method references. */
|
||||
const funcProto = Function.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
const funcToString = funcProto.toString;
|
||||
const funcToString = Function.prototype.toString;
|
||||
|
||||
/**
|
||||
* Converts `func` to its source code.
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import baseAssignValue from './_baseAssignValue.js';
|
||||
import createAggregator from './_createAggregator.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates an object composed of keys generated from the results of running
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import baseAssignValue from './_baseAssignValue.js';
|
||||
import createAggregator from './_createAggregator.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates an object composed of keys generated from the results of running
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import createInverter from './_createInverter.js';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* This method is like `invert` except that the inverted object is generated
|
||||
|
||||
@@ -11,11 +11,8 @@ import isTypedArray from './isTypedArray.js';
|
||||
const mapTag = '[object Map]';
|
||||
const setTag = '[object Set]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Checks if `value` is an empty object, collection, map, or set.
|
||||
|
||||
@@ -11,15 +11,11 @@ const reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
/** Used to detect host constructors (Safari). */
|
||||
const reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const funcProto = Function.prototype;
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
const funcToString = funcProto.toString;
|
||||
const funcToString = Function.prototype.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
const reIsNative = RegExp(`^${
|
||||
|
||||
@@ -5,15 +5,11 @@ import isObjectLike from './isObjectLike.js';
|
||||
/** `Object#toString` result references. */
|
||||
const objectTag = '[object Object]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
const funcProto = Function.prototype;
|
||||
const objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
const funcToString = funcProto.toString;
|
||||
const funcToString = Function.prototype.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/** Used to infer the `Object` constructor. */
|
||||
const objectCtorString = funcToString.call(Object);
|
||||
|
||||
5
join.js
5
join.js
@@ -1,8 +1,5 @@
|
||||
/** Used for built-in method references. */
|
||||
const arrayProto = Array.prototype;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
const nativeJoin = arrayProto.join;
|
||||
const nativeJoin = Array.prototype.join;
|
||||
|
||||
/**
|
||||
* Converts all elements in `array` into a string separated by `separator`.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/** Used for built-in method references. */
|
||||
const arrayProto = Array.prototype;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
const nativeReverse = arrayProto.reverse;
|
||||
const nativeReverse = Array.prototype.reverse;
|
||||
|
||||
/**
|
||||
* Reverses `array` so that the first element becomes the last, the second
|
||||
|
||||
Reference in New Issue
Block a user