UNPKG

@thi.ng/associative

Version:

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

17 lines (16 loc) 255 B
import { isMap } from "@thi.ng/checks/is-map"; function into(coll, src) { if (isMap(coll)) { for (let x of src) { coll.set(x[0], x[1]); } } else { for (let x of src) { coll.add(x); } } return coll; } export { into };