mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Rename arrayRef to arrayProto in build.js.
Former-commit-id: fec054f96a4972173cb638ee77a7a0d1813c9ad4
This commit is contained in:
16
build.js
16
build.js
@@ -18,16 +18,16 @@
|
|||||||
var cwd = process.cwd();
|
var cwd = process.cwd();
|
||||||
|
|
||||||
/** Used for array method references */
|
/** Used for array method references */
|
||||||
var arrayRef = [];
|
var arrayProto = Array.prototype;
|
||||||
|
|
||||||
/** Shortcut used to push arrays of values to an array */
|
/** Shortcut used to push arrays of values to an array */
|
||||||
var push = arrayRef.push;
|
var push = arrayProto.push;
|
||||||
|
|
||||||
/** Used to detect the Node.js executable in command-line arguments */
|
/** Used to detect the Node.js executable in command-line arguments */
|
||||||
var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$');
|
var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$');
|
||||||
|
|
||||||
/** Shortcut used to convert array-like objects to arrays */
|
/** Shortcut used to convert array-like objects to arrays */
|
||||||
var slice = arrayRef.slice;
|
var slice = arrayProto.slice;
|
||||||
|
|
||||||
/** Shortcut to the `stdout` object */
|
/** Shortcut to the `stdout` object */
|
||||||
var stdout = process.stdout;
|
var stdout = process.stdout;
|
||||||
@@ -406,7 +406,7 @@
|
|||||||
return indent + [
|
return indent + [
|
||||||
'// add `Array` mutator functions to the wrapper',
|
'// add `Array` mutator functions to the wrapper',
|
||||||
funcName + "(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {",
|
funcName + "(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {",
|
||||||
' var func = arrayRef[methodName];',
|
' var func = arrayProto[methodName];',
|
||||||
' lodash.prototype[methodName] = function() {',
|
' lodash.prototype[methodName] = function() {',
|
||||||
' var value = this.__wrapped__;',
|
' var value = this.__wrapped__;',
|
||||||
' func.apply(value, arguments);',
|
' func.apply(value, arguments);',
|
||||||
@@ -422,7 +422,7 @@
|
|||||||
'',
|
'',
|
||||||
'// add `Array` accessor functions to the wrapper',
|
'// add `Array` accessor functions to the wrapper',
|
||||||
funcName + "(['concat', 'join', 'slice'], function(methodName) {",
|
funcName + "(['concat', 'join', 'slice'], function(methodName) {",
|
||||||
' var func = arrayRef[methodName];',
|
' var func = arrayProto[methodName];',
|
||||||
' lodash.prototype[methodName] = function() {',
|
' lodash.prototype[methodName] = function() {',
|
||||||
' var value = this.__wrapped__,',
|
' var value = this.__wrapped__,',
|
||||||
' result = func.apply(value, arguments);',
|
' result = func.apply(value, arguments);',
|
||||||
@@ -2172,7 +2172,7 @@
|
|||||||
'function difference(array) {',
|
'function difference(array) {',
|
||||||
' var index = -1,',
|
' var index = -1,',
|
||||||
' length = array.length,',
|
' length = array.length,',
|
||||||
' flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),',
|
' flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),',
|
||||||
' result = [];',
|
' result = [];',
|
||||||
'',
|
'',
|
||||||
' while (++index < length) {',
|
' while (++index < length) {',
|
||||||
@@ -2357,7 +2357,7 @@
|
|||||||
if (!useLodashMethod('omit')) {
|
if (!useLodashMethod('omit')) {
|
||||||
source = replaceFunction(source, 'omit', [
|
source = replaceFunction(source, 'omit', [
|
||||||
'function omit(object) {',
|
'function omit(object) {',
|
||||||
' var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),',
|
' var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),',
|
||||||
' result = {};',
|
' result = {};',
|
||||||
'',
|
'',
|
||||||
' forIn(object, function(value, key) {',
|
' forIn(object, function(value, key) {',
|
||||||
@@ -2374,7 +2374,7 @@
|
|||||||
source = replaceFunction(source, 'pick', [
|
source = replaceFunction(source, 'pick', [
|
||||||
'function pick(object) {',
|
'function pick(object) {',
|
||||||
' var index = -1,',
|
' var index = -1,',
|
||||||
' props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),',
|
' props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),',
|
||||||
' length = props.length,',
|
' length = props.length,',
|
||||||
' result = {};',
|
' result = {};',
|
||||||
'',
|
'',
|
||||||
|
|||||||
Reference in New Issue
Block a user