UNPKG

@thi.ng/associative

Version:

ES Map/Set-compatible implementations with customizable equality semantics & supporting operations

9 lines (8 loc) 235 B
import { isMap } from "@thi.ng/checks/is-map"; import { isSet } from "@thi.ng/checks/is-set"; const ensureMap = (x) => isMap(x) ? x : new Map(x); const ensureSet = (x) => isSet(x) ? x : new Set(x); export { ensureMap, ensureSet };