jlist
v0.1.8
Published
Data structure based on index
Downloads
3
Readme
New list structure in Javascript
Init new lists
const JList = require('./JList');
const list1 = new JList();
const list2 = new JList({'test': 1}, 3 , 'awdawd');
Return elements
list.getElements()
Size of list
list.size();
Clear list
list.clear();
Add element
list.add(1) // one param - index
list.addBack('text') // one param - add value at first free index
Get element
list.get(1) // return value from element at 1 index or if not exist then throw error
list.getBiggestIndex() // return the biggest index in list
list.getValueOfBiggestIndex() // return value of the biggest index in list
Update element
list.update(1, 'text') // two params - index and value. Throw error if element at index not exist
Delete element
list.delete(1) // one param - index. Throw error if element at index not exist