mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Ensure "Arrays" and "Objects" methods work with arguments objects and arrays respectively.
Former-commit-id: aebb7a0004d804b7fd43d73e24d1da28c67f4059
This commit is contained in:
14
build.js
14
build.js
@@ -168,7 +168,7 @@
|
||||
'times': ['createCallback'],
|
||||
'toArray': ['isString', 'values'],
|
||||
'unescape': [],
|
||||
'union': ['uniq'],
|
||||
'union': ['isArray', 'uniq'],
|
||||
'uniq': ['createCallback', 'indexOf'],
|
||||
'uniqueId': [],
|
||||
'unzip': ['max', 'pluck'],
|
||||
@@ -2030,12 +2030,12 @@
|
||||
'function difference(array) {',
|
||||
' var index = -1,',
|
||||
' length = array.length,',
|
||||
' flattened = concat.apply(arrayRef, arguments),',
|
||||
' flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),',
|
||||
' result = [];',
|
||||
'',
|
||||
' while (++index < length) {',
|
||||
' var value = array[index];',
|
||||
' if (indexOf(flattened, value, length) < 0) {',
|
||||
' if (indexOf(flattened, value) < 0) {',
|
||||
' result.push(value);',
|
||||
' }',
|
||||
' }',
|
||||
@@ -2219,11 +2219,11 @@
|
||||
// replace `_.omit`
|
||||
source = replaceFunction(source, 'omit', [
|
||||
'function omit(object) {',
|
||||
' var props = concat.apply(arrayRef, arguments),',
|
||||
' var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),',
|
||||
' result = {};',
|
||||
'',
|
||||
' forIn(object, function(value, key) {',
|
||||
' if (indexOf(props, key, 1) < 0) {',
|
||||
' if (indexOf(props, key) < 0) {',
|
||||
' result[key] = value;',
|
||||
' }',
|
||||
' });',
|
||||
@@ -2234,8 +2234,8 @@
|
||||
// replace `_.pick`
|
||||
source = replaceFunction(source, 'pick', [
|
||||
'function pick(object) {',
|
||||
' var index = 0,',
|
||||
' props = concat.apply(arrayRef, arguments),',
|
||||
' var index = -1,',
|
||||
' props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),',
|
||||
' length = props.length,',
|
||||
' result = {};',
|
||||
'',
|
||||
|
||||
Reference in New Issue
Block a user