Installation
npm install identical-list
Usage
How to use List class
var List = require("identical-list");
var array = [{id: 1, msg: "Hi"}, {id: 2, msg: "Hello"}, {id: 10, msg: "Im Manh"}];
let list = new List(array);
console.log(list.asArray());
console.log(list.get(10));
Add new element to list
list.add({id: 5, msg: "I love javascript"});
console.log(list.asArray());
Update an element of list
let updatedObject = {id: 1, msg: "How are you?"}
list.add(updatedObject);
console.log(list.asArray());
Remove an element of list
list.deleteId(10);
console.log(list.asArray());