Consolidate prototype vars used only once.

This commit is contained in:
John-David Dalton
2017-01-09 18:16:47 -08:00
parent bc4262f901
commit f2c49500ee
25 changed files with 27 additions and 104 deletions

View File

@@ -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`.

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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`.

View File

@@ -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

View File

@@ -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

View File

@@ -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`.

View File

@@ -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;

View File

@@ -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`.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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`.

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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(`^${

View File

@@ -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);

View File

@@ -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`.

View File

@@ -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