| /** |
| * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/> |
| * Build: `lodash modularize modern exports="node" -o ./modern/` |
| * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> |
| * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE> |
| * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors |
| * Available under MIT license <http://lodash.com/license> |
| */ |
| |
| /** |
| * Used for `Array` method references. |
| * |
| * Normally `Array.prototype` would suffice, however, using an array literal |
| * avoids issues in Narwhal. |
| */ |
| var arrayRef = []; |
| |
| /** Native method shortcuts */ |
| var splice = arrayRef.splice; |
| |
| /** |
| * Removes all provided values from the given array using strict equality for |
| * comparisons, i.e. `===`. |
| * |
| * @static |
| * @memberOf _ |
| * @category Arrays |
| * @param {Array} array The array to modify. |
| * @param {...*} [value] The values to remove. |
| * @returns {Array} Returns `array`. |
| * @example |
| * |
| * var array = [1, 2, 3, 1, 2, 3]; |
| * _.pull(array, 2, 3); |
| * console.log(array); |
| * // => [1, 1] |
| */ |
| function pull(array) { |
| var args = arguments, |
| argsIndex = 0, |
| argsLength = args.length, |
| length = array ? array.length : 0; |
| |
| while (++argsIndex < argsLength) { |
| var index = -1, |
| value = args[argsIndex]; |
| while (++index < length) { |
| if (array[index] === value) { |
| splice.call(array, index--, 1); |
| length--; |
| } |
| } |
| } |
| return array; |
| } |
| |
| module.exports = pull; |