1.0.1 • Published 8 years ago
@sets/difference v1.0.1
@sets/difference
Return the difference between two sets, or the symmetric difference between two sets.
const difference = require('@sets/difference')
console.log(difference(
new Set('hello'),
new Set('world'))
)) // "he"
console.log(difference.symmetric(
new Set('hello'),
new Set('world'))
)) // "hewrd"Installation
$ npm install --save @sets/differenceAPI
difference(lhs, rhs) -> Set
Return the difference between the sets represented by lhs and rhs. The
resulting set will contain all elements from lhs that do not appear in rhs.
difference.symmetric(lhs, rhs) -> Set
Return the symmetric difference between the sets represented by lhs and rhs. The
resulting set will contain all elements from lhs that do not appear in rhs and
all elements from rhs that do not appear in lhs.
License
MIT