Skip to content

intersection

intersection<K, V>(other): (m) => ReadonlyMap<K, V>

Defined in: Utils/Dict.ts:366

Returns a new dictionary containing only the entries whose keys appear in both dictionaries. Values are taken from the left (base) dictionary.

K

V

ReadonlyMap<K, unknown>

(m): ReadonlyMap<K, V>

ReadonlyMap<K, V>

ReadonlyMap<K, V>

pipe(
  Dict.fromEntries([["a", 1], ["b", 2], ["c", 3]]),
  Dict.intersection(Dict.fromEntries([["b", 99], ["c", 0]])),
);
// ReadonlyMap { "b" => 2, "c" => 3 }