|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
781 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Creates an array that excludes all specified values.
|
|---|
| 3 | *
|
|---|
| 4 | * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
|
|---|
| 5 | *
|
|---|
| 6 | * @template T The type of elements in the array.
|
|---|
| 7 | * @param {T[]} array - The array to filter.
|
|---|
| 8 | * @param {...T[]} values - The values to exclude.
|
|---|
| 9 | * @returns {T[]} A new array without the specified values.
|
|---|
| 10 | *
|
|---|
| 11 | * @example
|
|---|
| 12 | * // Removes the specified values from the array
|
|---|
| 13 | * without([1, 2, 3, 4, 5], 2, 4);
|
|---|
| 14 | * // Returns: [1, 3, 5]
|
|---|
| 15 | *
|
|---|
| 16 | * @example
|
|---|
| 17 | * // Removes specified string values from the array
|
|---|
| 18 | * without(['a', 'b', 'c', 'a'], 'a');
|
|---|
| 19 | * // Returns: ['b', 'c']
|
|---|
| 20 | */
|
|---|
| 21 | declare function without<T>(array: readonly T[], ...values: T[]): T[];
|
|---|
| 22 |
|
|---|
| 23 | export { without };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.