A collection / dictionary list library for javascript. It provides a way to create enhanced Arrays, with search capabilities. Introduces two additional types of Arrays, the List and the Dictionary.
npm i collection-util-js
Declare the dist/collection-min.js to your html file and use it.
<script src="./node_modules/collection-util-js/dist/collection-min.js"></script>
- List Object
- Dictionary Object
var somelist = new Collection.List();
var someDictionary = new Collection.Dictionary();
- get
- add
- iterate
- remove
- has
- toArray
- parse
- toJSON
- get
- add
- iterate
- remove
- has
- hasKey
- toArray
- parse
- toJSON
var somelist = new Collection.List();
somelist.add('hello');
somelist.add('test');
somelist.toArray() // ['hello', 'test']
var someDictionary = new Collection.Dictionary();
somelist.add('MyKey', 'MyValue');
somelist.add('MyKey2', 'MyValue2');
somelist.toArray(); // ['MyValue', 'MyValue']
somelist.get('MyKey') // => MyValue
You can test running the following command in package's directory:
npm test