Creates a new array excluding all provided values using SameValueZero equality comparisons
npx @tessl/cli install tessl/npm-lodash--without@3.2.0The modern build of lodash's _.without as a module. Creates a new array excluding all provided values using SameValueZero equality comparisons for efficient array filtering without the overhead of the full lodash library.
npm install lodash.withoutvar without = require('lodash.without');ES module import (in environments that support it):
import without from 'lodash.without';var without = require('lodash.without');
// Remove specific values from an array
var result = without([1, 2, 1, 3], 1, 2);
// => [3]
// Works with different data types
var mixed = without(['a', 'b', 'c', 'a'], 'a', 'b');
// => ['c']
// Returns empty array if input is not array-like
var invalid = without('not-an-array', 1, 2);
// => []Creates an array excluding all provided values using SameValueZero equality comparisons.
/**
* Creates an array excluding all provided values using
* SameValueZero for equality comparisons.
*
* @param {Array} array The array to filter.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
*/
function without(array, ...values);Parameters:
array (Array): The array to filter...values (...*): The values to exclude (variable arguments)Returns:
Behavior:
=== but treats NaN as equal to NaN)Usage Examples:
var without = require('lodash.without');
// Basic number filtering
without([1, 2, 1, 3], 1, 2);
// => [3]
// String filtering
without(['apple', 'banana', 'apple', 'cherry'], 'apple');
// => ['banana', 'cherry']
// Mixed type filtering
without([1, 'a', 2, 'b', 1], 1, 'a');
// => [2, 'b']
// Multiple exclusions
without([1, 2, 3, 4, 5], 2, 4);
// => [1, 3, 5]
// No matches - returns copy
without([1, 2, 3], 4, 5);
// => [1, 2, 3]
// Empty array input
without([], 1, 2);
// => []
// Non-array input returns empty array
without('not-an-array', 1);
// => []
without(null, 1);
// => []