Files
lodash/without.js
John-David Dalton 3d3ce0979f Bump to v4.14.2.
2016-08-07 21:21:03 -07:00

31 lines
882 B
JavaScript

define(['./_baseDifference', './_baseRest', './isArrayLikeObject'], function(baseDifference, baseRest, isArrayLikeObject) {
/**
* Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `_.pull`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.xor
* @example
*
* _.without([2, 1, 2, 3], 1, 2);
* // => [3]
*/
var without = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, values)
: [];
});
return without;
});