UNPKG

jsmodern

Version:

An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.

19 lines 541 B
import { utilIsSet } from './is-set'; export const difference = { label: 'difference', fn: function setDifference(other) { const ctx = this; if (!utilIsSet(other)) throw new TypeError(`Expect 'other' to be a Set`); if (!ctx.size && !other.size) return []; const diffList = []; for (const n of ctx) { if (other.has(n)) continue; diffList.push(n); } return diffList; }, }; //# sourceMappingURL=difference.js.map