withoutAll

import { withoutAll } from "jsr:@ende/collections";

function

function withoutAll<T>(iterable: Iterable<T>, values: Iterable<T>): T[]

Returns an array excluding all given values from an iterable.

Note: If both inputs are Sets, and you want the difference as a Set, you could use Set.prototype.difference instead.

iterable: Iterable<T>

The iterable to exclude values from.

values: Iterable<T>

The values to exclude from the iterable.

Returns

An array containing all elements from iterables except the ones that are in the values iterable.

Example: Basic usage

import { withoutAll } from "@ende/collections/without-all";
import { assertEquals } from "@ende/assert";

const withoutList = withoutAll([2, 1, 2, 3], [1, 2]);

assertEquals(withoutList, [3]);

Source