JSPM

compare-sets

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 275
  • Score
    100M100P100Q114167F
  • License MIT

Given two sets, `compare-sets` will return sets of the added, retained, and removed items

Package Exports

  • compare-sets

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (compare-sets) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

compare-sets

Given two sets, compare-sets will return sets of the added, retained, and removed items

Installation

npm install [--save] compare-sets

Usage

var oldSet = new Set([1, 2, 3, 4])
var newSet = new Set([2, 4, 5, 6])

compareSets(oldSet, newSet)
// {
//   added: Set { 5, 6 },
//   retained: Set { 2, 4 },
//   remvoed: Set { 1, 3 }
// }

Caveats

This library assumes an environment with Set available