3.0.0 - 2023-05-xx
sort(compareFn?)
: sort items in the set using an optionalcompareFn
- test on Node.js v20
- bump dependencies
- require Node.js v16, drop support for Node.js v12 and v14
- remove static
Set.of
method, useSet.from
instead
2.2.1 - 2022-01-07
- bump dependencies
- use
@supercharge/eslint-config-typescript
- properly handle string inputs added to a set when iterating over all inputs
2.2.0 - 2021-11-08
all(predicate)
: determine whether all of the values in the set matches the given predicate functionany(predicate)
: determine whether at least one of the values in the set matches the given predicate functionfindLast(predicate)
: returns the last item in the set matching the given predicate functionfindLastIndex(predicate)
: returns the index of the last item in the set that matches the givenpredicate
function, -1 otherwiseintersect(...collections)
: returns a set containing all items that are contained in all collections, this set and and the givencollections
- bump dependencies
- use
uvu
andc8
instead ofjest
for testing add(...values)
method now supports adding multiple values
2.1.0 - 2021-08-28
Set.from()
method to create a new set. This method aligns with JavaScript’sArray.from
method
- bump dependencies
2.0.0 - 2021-06-18
isMissing(value)
method determining whether the givenvalue
is missing in the setfindIndex(predicate)
method determining the index of a given item. Returns-1
if the item is not present in the set
- bump dependencies
Starting in 2.x
we use a new comparison to determine whether an item exists in the Set. In contrast, in version 1.x
we relied on the native JavaScript Set
class to ensure unique values in the set. But that didn’t work properly, for example when adding an object with the same values twice.
-
a
set
contains only items that are not deeply equal to each other// 2.x const set = Set.of([{ name: 'Marcus' }]) set.size() // 1 set.add({ name: 'Marcus' }) set.size() // 1 (because the objects are "deeply equal") // 1.x const set = Set.of([{ name: 'Marcus' }]) set.size() // 1 set.add({ name: 'Marcus' }) set.size() // 2 (because the objects are "not the same" reference)
-
signature changes for a handful of methods: added
index
as the second argument offind
,map
,flatMap
,filter
,forEach
,first
,last
,count
,includes
,join
,reduce
// 2.x const set = Set.of(['Marcus', 'Norman', 'Christian']) set.map((name, index, set) => {}) // "index" is the second argument, "set" becomes the third // 1.x const set = Set.of(['Marcus', 'Norman', 'Christian']) set.map((name, set) => {}) // "set" was the second argument
1.9.0 - 2021-05-13
- allow callback method as a seperator for
join(separator?)
- Example:
Set.of(['name', 'title']).join(item => { return `<${item}> ` }) // '<name> <title> '
- bump dependencies
1.8.0 - 2021-05-06
join(separator?)
method: returns a string of all items concatenated using the givenseparator
.
- bump dependencies
1.7.0 - 2021-05-03
at(index)
method: returns the item at the givenindex
first(predicate?)
method: returns the first item in the set or the first item matching the givenpredicate
function
- bump dependencies
1.6.0 - 2020-10-27
reduce()
method: works the same way as in arrays :)
- bump dependencies
- improve typings of the
.filter()
method
1.5.0 - 2020-10-17
includes(value|predicate)
method: determine whether the set includes a givenvalue
or check if it includes a value by using apredicate
function
- bump dependencies
- improve typings of the
.find()
method
1.4.0 - 2020-10-12
concat(...values)
method: add an array or individual values to a setcount(predicate)
method: returns the number of items matching the givenpredicate
function
- bump dependencies
- refine package description in README
1.3.0 - 2020-08-31
flatten()
method: flatten the set one level deepflatMap(transform)
method: returns a new set instance from applying the giventransform
function on each item in the source set and ultimately collapsing the result- generate HTML coverage report from jest
1.2.0 - 2020-08-21
- bump dependencies
- change
main
entrypoint inpackage.json
todist
folder - devDependencies: move test runner from
@hapi/lab
tojest
- remove
index.js
file which acted as a middleman to export fromdist
folder
1.1.0 - 2020-08-05
- implement the
Iterable
interface via[Symbol.iterator]
to allow iterators andfor..of
loops
- bump dependencies
1.0.0
release 🚀 🎉