1.0.4 • Published 5 years ago

uniqlist v1.0.4

Weekly downloads
146
License
MIT
Repository
github
Last release
5 years ago

UniqList

Build Status Code Climate npm version

Install

npm install uniqlist

How to use

Example 1

const UniqList = require("uniqlist");
const ul = new UniqList();

ul.push(10);
ul.push(10);
ul.push(11);
ul.push(11);
ul.push(11);

ul.size(); // 2
ul.get(0); // 10
ul.get(1); // 11

const arr = ul.toArray(); // [10, 11]

Example 2

const UniqList = require("uniqlist");
const ul = new UniqList();

ul.push({ msg: "hello!" }, "key10");
ul.push({ msg: "hello!!" }, "key10");
ul.push({ msg: "hello!!!" }, "key10");
ul.push({ msg: "hello?" }, "key11");
ul.push({ msg: "hello??" }, "key11");
ul.push({ msg: "hello???" }, "key11");

ul.size(); // 2
ul.get(0).msg; // "hello!"
ul.get(1).msg; // "hello?"

const arr = ul.toArray(); // [{ msg:"hello!"}, { msg:"hello?"}]

Example 3

const ul = new UniqList();
ul.filter = a => a % 2 == 0;

ul.push(1);
ul.push(3);
ul.push(5);

ul.size(); // 0

ul.push(1);
ul.push(2);
ul.push(3);
ul.push(4);

ul.size(); // 2

const arr = ul.toArray(); // [2, 4]
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago