1.0.1 • Published 6 years ago
linked-list-implementation v1.0.1
Linked List :link: :smiley:
Linked lists implementation:
You can create a linked list from an existing array:
let list = new LinkedList([
{ id: 1, name: 'Superman'}, { id: 2, name: 'Batman' }, { id: 3, name: 'Thor' }
]);or just create a new one:
let list = new LinkedList();Methods List:
- push 
list.push(value) - pop 
list.pop() - get 
list.get(3) - set 
list.set(3, value) - insert 
list.insert(3, value) - remove 
list.remove(3) - shift 
list.shift() - unshift 
list.unshift(value) - reverse 
list.reverse() - toArray 
list.toArray() - forEach 
list.forEach(item => item) - map 
list.map(item => item.name) - filter 
list.filter(item => item.id !== 3) - some 
list.some(item => item.id === 3) - distinct 
list.distinct(item => item.id) - findIndex 
list.findIndex(item => item.id === 3) - selectMany 
list.selectMany(item => item.products)