Spark-Collection
A Collection library for when arrays are not enough
Installation
Install package with NPM :
npm install spark-collection
You can install it directly from github:
npm install kevthunder/spark-collection
Usage
Include it in your script :
const Collection =
It accepts an array as a argument :
const items = 12console // 1 2
Has function to add and remove unique items :
const items = 123itemsconsole // 1 3itemsconsole // 1 3 4items // do nothing since it existsconsole // 1 3 4
You can use any function from arrays and it will return a new Collection if needed :
const items = 1234const pair = itemsconsole // 2 4pairconsole // 2 4 6pairconsole // 2 4