or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

index.md

index.mddocs/

0

# Lodash Without

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: lodash.without

7

- **Package Type**: npm

8

- **Language**: JavaScript

9

- **Installation**: `npm install lodash.without`

10

11

## Core Imports

12

13

```javascript

14

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

15

```

16

17

ES module import (in environments that support it):

18

19

```javascript

20

import without from 'lodash.without';

21

```

22

23

## Basic Usage

24

25

```javascript

26

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

27

28

// Remove specific values from an array

29

var result = without([1, 2, 1, 3], 1, 2);

30

// => [3]

31

32

// Works with different data types

33

var mixed = without(['a', 'b', 'c', 'a'], 'a', 'b');

34

// => ['c']

35

36

// Returns empty array if input is not array-like

37

var invalid = without('not-an-array', 1, 2);

38

// => []

39

```

40

41

## Capabilities

42

43

### Array Filtering

44

45

Creates an array excluding all provided values using SameValueZero equality comparisons.

46

47

```javascript { .api }

48

/**

49

* Creates an array excluding all provided values using

50

* SameValueZero for equality comparisons.

51

*

52

* @param {Array} array The array to filter.

53

* @param {...*} [values] The values to exclude.

54

* @returns {Array} Returns the new array of filtered values.

55

*/

56

function without(array, ...values);

57

```

58

59

**Parameters:**

60

- `array` (Array): The array to filter

61

- `...values` (...*): The values to exclude (variable arguments)

62

63

**Returns:**

64

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

65

66

**Behavior:**

67

- Uses SameValueZero equality comparison (similar to `===` but treats `NaN` as equal to `NaN`)

68

- Returns a new array without modifying the original

69

- Returns empty array if first argument is not array-like

70

- Accepts any number of values to exclude as additional arguments

71

72

**Usage Examples:**

73

74

```javascript

75

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

76

77

// Basic number filtering

78

without([1, 2, 1, 3], 1, 2);

79

// => [3]

80

81

// String filtering

82

without(['apple', 'banana', 'apple', 'cherry'], 'apple');

83

// => ['banana', 'cherry']

84

85

// Mixed type filtering

86

without([1, 'a', 2, 'b', 1], 1, 'a');

87

// => [2, 'b']

88

89

// Multiple exclusions

90

without([1, 2, 3, 4, 5], 2, 4);

91

// => [1, 3, 5]

92

93

// No matches - returns copy

94

without([1, 2, 3], 4, 5);

95

// => [1, 2, 3]

96

97

// Empty array input

98

without([], 1, 2);

99

// => []

100

101

// Non-array input returns empty array

102

without('not-an-array', 1);

103

// => []

104

105

without(null, 1);

106

// => []

107

```