mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-14 12:47:49 +00:00
Fix build.
Former-commit-id: 99b283a2f26a9f5973799ad6757bfdc57d0a0404
This commit is contained in:
9
build.js
9
build.js
@@ -402,10 +402,10 @@
|
|||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
// replace wrapper `Array` method assignments
|
// replace wrapper `Array` method assignments
|
||||||
source = source.replace(/^(?: *\/\/.*\n)*( *)each\(\['[\s\S]+?\n\1}$/m, function(match, indent) {
|
source = source.replace(/^(?:(?: *\/\/.*\n)*(?: *if *\(.+\n)?( *)(each|forEach)\(\['[\s\S]+?\n\1}\);(?:\n *})?\n+)+/m, function(match, indent, funcName) {
|
||||||
return indent + [
|
return indent + [
|
||||||
'// add `Array` mutator functions to the wrapper',
|
'// add `Array` mutator functions to the wrapper',
|
||||||
"each(['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 = arrayRef[methodName];',
|
||||||
' lodash.prototype[methodName] = function() {',
|
' lodash.prototype[methodName] = function() {',
|
||||||
' var value = this.__wrapped__;',
|
' var value = this.__wrapped__;',
|
||||||
@@ -421,7 +421,7 @@
|
|||||||
'});',
|
'});',
|
||||||
'',
|
'',
|
||||||
'// add `Array` accessor functions to the wrapper',
|
'// add `Array` accessor functions to the wrapper',
|
||||||
"each(['concat', 'join', 'slice'], function(methodName) {",
|
funcName + "(['concat', 'join', 'slice'], function(methodName) {",
|
||||||
' var func = arrayRef[methodName];',
|
' var func = arrayRef[methodName];',
|
||||||
' lodash.prototype[methodName] = function() {',
|
' lodash.prototype[methodName] = function() {',
|
||||||
' var value = this.__wrapped__,',
|
' var value = this.__wrapped__,',
|
||||||
@@ -433,7 +433,8 @@
|
|||||||
' }',
|
' }',
|
||||||
' return result;',
|
' return result;',
|
||||||
' };',
|
' };',
|
||||||
'});'
|
'});',
|
||||||
|
''
|
||||||
].join('\n' + indent);
|
].join('\n' + indent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
54
dist/lodash.underscore.js
vendored
54
dist/lodash.underscore.js
vendored
@@ -4357,36 +4357,36 @@
|
|||||||
lodash.prototype.chain = wrapperChain;
|
lodash.prototype.chain = wrapperChain;
|
||||||
lodash.prototype.value = wrapperValueOf;
|
lodash.prototype.value = wrapperValueOf;
|
||||||
|
|
||||||
// add `Array` mutator functions to the wrapper
|
// add `Array` mutator functions to the wrapper
|
||||||
forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
||||||
var func = arrayRef[methodName];
|
var func = arrayRef[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);
|
||||||
|
|
||||||
// avoid array-like object bugs with `Array#shift` and `Array#splice`
|
// avoid array-like object bugs with `Array#shift` and `Array#splice`
|
||||||
// in Firefox < 10 and IE < 9
|
// in Firefox < 10 and IE < 9
|
||||||
if (!support.spliceObjects && value.length === 0) {
|
if (!support.spliceObjects && value.length === 0) {
|
||||||
delete value[0];
|
delete value[0];
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// add `Array` accessor functions to the wrapper
|
// add `Array` accessor functions to the wrapper
|
||||||
forEach(['concat', 'join', 'slice'], function(methodName) {
|
forEach(['concat', 'join', 'slice'], function(methodName) {
|
||||||
var func = arrayRef[methodName];
|
var func = arrayRef[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);
|
||||||
|
|
||||||
if (this.__chain__) {
|
if (this.__chain__) {
|
||||||
result = new lodashWrapper(result);
|
result = new lodashWrapper(result);
|
||||||
result.__chain__ = true;
|
result.__chain__ = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user