or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-lodash--without

Creates a new array excluding all provided values using SameValueZero equality comparisons

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/lodash.without@3.2.x

To install, run

npx @tessl/cli install tessl/npm-lodash--without@3.2.0

index.mddocs/

Lodash Without

The 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.

Package Information

  • Package Name: lodash.without
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install lodash.without

Core Imports

var without = require('lodash.without');

ES module import (in environments that support it):

import without from 'lodash.without';

Basic Usage

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);
// => []

Capabilities

Array Filtering

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:

  • (Array): Returns the new array of filtered values

Behavior:

  • Uses SameValueZero equality comparison (similar to === but treats NaN as equal to NaN)
  • Returns a new array without modifying the original
  • Returns empty array if first argument is not array-like
  • Accepts any number of values to exclude as additional arguments

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);
// => []