1.4.1 • Published 1 year ago

anabolicset v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

You'll never use Set again...

AnabolicSet is built around the optional ability to customize item comparisons with a custom serializer. The uniqueness is guaranteed for the return value of the serializer.

This allows you to do things like:

const set1 = new AnabolicSet([{ id: 1 }, { id: 2 }, { id: 2 }], (obj) => obj.id) // <-- serializer
set1.values() // [{id: 1}, {id: 2}]

Featuring...

const set1 = new AnabolicSet([1, 2, 3, 4, 5])
const set2 = new AnabolicSet([2, 4])

set1.addAll(...[5, 6])
set1.values() // [1, 2, 3, 4, 5, 6]

set2.isSubsetOf(set1) // true
set1.isSupersetOf(set2) // true

set2.add(7)
set1.union(set2) // AnabolicSet [1, 2, 3, 4, 5, 6, 7]

Import

npm:

$ npm i anabolicset
import { AnabolicSet } from 'anabolicset/src/anabolicset'

cdn:

<script src="https://cdn.jsdelivr.net/gh/ColonelParrot/AnabolicSet@latest/src/anabolicset.min.js"></script>
1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago