mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Remove "Collections" method _.forEach dependency from "Arrays" method _.intersection.
Former-commit-id: 83197c7ac47654c6fc2d2f37df8ff77d4adb9096
This commit is contained in:
18
build.js
18
build.js
@@ -95,7 +95,7 @@
|
||||
'identity': [],
|
||||
'indexOf': ['sortedIndex'],
|
||||
'initial': [],
|
||||
'intersection': ['forEach', 'indexOf'],
|
||||
'intersection': ['indexOf'],
|
||||
'invert': ['forOwn'],
|
||||
'invoke': ['forEach'],
|
||||
'isArguments': [],
|
||||
@@ -1441,19 +1441,23 @@
|
||||
' function intersection(array) {',
|
||||
' var args = arguments,',
|
||||
' argsLength = args.length,',
|
||||
' index = -1,',
|
||||
' length = array ? array.length : 0,',
|
||||
' result = [];',
|
||||
'',
|
||||
' forEach(array, function(value) {',
|
||||
' outer:',
|
||||
' while (++index < length) {',
|
||||
' var value = array[index];',
|
||||
' if (indexOf(result, value) < 0) {',
|
||||
' var length = argsLength;',
|
||||
' while (--length) {',
|
||||
' if (indexOf(args[length], value) < 0) {',
|
||||
' return;',
|
||||
' var argsIndex = argsLength;',
|
||||
' while (--argsIndex) {',
|
||||
' if (indexOf(args[argsIndex], value) < 0) {',
|
||||
' continue outer;',
|
||||
' }',
|
||||
' }',
|
||||
' result.push(value);',
|
||||
' }',
|
||||
' });',
|
||||
' }',
|
||||
' return result;',
|
||||
' }'
|
||||
].join('\n'));
|
||||
|
||||
Reference in New Issue
Block a user