// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

/**
 * Returns an array excluding all given values.
 *
 * @template T The type of the array elements.
 *
 * @param array The array to exclude values from.
 * @param values The values to exclude from the array.
 *
 * @returns A new array containing all elements from the given array except the
 * ones that are in the values array.
 *
 * @example Basic usage
 * ```ts
 * import { withoutAll } from "@std/collections/without-all";
 * import { assertEquals } from "@std/assert/assert-equals";
 *
 * const withoutList = withoutAll([2, 1, 2, 3], [1, 2]);
 *
 * assertEquals(withoutList, [3]);
 * ```
 */
export function withoutAll<T>(array: readonly T[], values: readonly T[]): T[] {
  const toExclude = new Set(values);
  return array.filter((it) => !toExclude.has(it));
}

// denoCacheMetadata={"headers":{"cf-ray":"a223e6564f4b7db6-LAX","content-length":"883","access-control-expose-headers":"*","x-content-type-options":"nosniff","content-type":"text/typescript","x-robots-tag":"noindex","cross-origin-resource-policy":"cross-origin","x-jsr-backend":"modules","cache-control":"public, max-age=31536000, immutable","vary":"Origin","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","set-cookie":"__cf_bm=JAZckMTQbb51a2isNv6SMU5tB22_s1JTACSI1Gfd5Q8-1785241874.9676015-1.0.1.1-VQFrndXeUeUXW7Zf_jrF6IsCG4KnDmajVTDIWZQc2DbxZriSJpjjqy8rQaOB5FeokUm4Ut2whgRXUaNi.6aR3tvtMACVaNVUL.KH.qmtNB3lPvXs1dpUClCvGIZQzlla; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","etag":"\"2f9bdb93257903f3d435db1224064040\"","server":"cloudflare","alt-svc":"h3=\":443\"; ma=86400","access-control-allow-origin":"*","date":"Tue, 28 Jul 2026 12:31:15 GMT","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=SuY88jYmzqd9NYdbRxwhFBKzM8u%2FxRUwvjDkHh51mli9DnbbdKGfySBUp3FDR1kLfbZkxb3K5Q8LB9gEMvOIWThiJR0URM2q8DzPtnZDa3CQqaHS0%2Bnjl0M%3D\"}]}"},"url":"https://jsr.io/@std/collections/0.224.2/without_all.ts","time":1785241875}