Intersection
Gets the intersection of the two arrays or sets
Example:
import { intersection } from "@thalesrc/js-utils/array";
const base = ["a", "b", "c", "d", "a", "b", "c", "d"];
intersection(base, ["a", "b", "x"]); // ["a", "b", "a", "b"]
intersection(base, ["a", "b", "x"], false); // ["a", "b"]
Array Prototype Example:
import "@thalesrc/js-utils/array/proto/intersection";
const base = ["a", "b", "c", "d", "a", "b", "c", "d"];
base.intersection(["a", "b"]); // ["a", "b", "a", "b"]
Set Prototype Example:
import "@thalesrc/js-utils/set/proto/intersection";
const base = new Set(["a", "b", "c", "d"]);
base.intersection(["a", "b"]); // Set(["a", "b"])
Base Set or Array
Set or Array to include its values
By default all the same items encountered in the inclusion will be included, set this argument as false to get real intersection
Intersection of base and inclusion
Generated using TypeDoc
Intersection Inclusion Type