* The base implementation of `_.difference` which accepts a single array * of values to exclude. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @returns {Array} Returns the new array of filtered values.
(array, values)
| 3340 | * @returns {Array} Returns the new array of filtered values. |
| 3341 | */ |
| 3342 | function baseDifference(array, values) { |
| 3343 | var length = array ? array.length : 0, |
| 3344 | result = []; |
| 3345 | |
| 3346 | if (!length) { |
| 3347 | return result; |
| 3348 | } |
| 3349 | var index = -1, |
| 3350 | indexOf = getIndexOf(), |
| 3351 | isCommon = indexOf == baseIndexOf, |
| 3352 | cache = (isCommon && values.length >= 200) ? createCache(values) : null, |
| 3353 | valuesLength = values.length; |
| 3354 | |
| 3355 | if (cache) { |
| 3356 | indexOf = cacheIndexOf; |
| 3357 | isCommon = false; |
| 3358 | values = cache; |
| 3359 | } |
| 3360 | outer: |
| 3361 | while (++index < length) { |
| 3362 | var value = array[index]; |
| 3363 | |
| 3364 | if (isCommon && value === value) { |
| 3365 | var valuesIndex = valuesLength; |
| 3366 | while (valuesIndex--) { |
| 3367 | if (values[valuesIndex] === value) { |
| 3368 | continue outer; |
| 3369 | } |
| 3370 | } |
| 3371 | result.push(value); |
| 3372 | } |
| 3373 | else if (indexOf(values, value, 0) < 0) { |
| 3374 | result.push(value); |
| 3375 | } |
| 3376 | } |
| 3377 | return result; |
| 3378 | } |
| 3379 | |
| 3380 | /** |
| 3381 | * The base implementation of `_.forEach` without support for callback |
no test coverage detected