Package Exports
- collection-util-js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (collection-util-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CollectionJS
- Javascript dictionary library v1.5.9
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.
Installation
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>
Types
- List Object
- Dictionary Object
var somelist = new Collection.List();
var someDictionary = new Collection.Dictionary();
List Methods
- get
- add
- iterate
- remove
- has
- toArray
- parse
- toJSON
Dictionary Methods
- get
- add
- iterate
- remove
- has
- hasKey
- toArray
- parse
- toJSON
Examples
List
var somelist = new Collection.List();
somelist.add('hello');
somelist.add('test');
somelist.toArray() // ['hello', 'test']
Dictionary
var someDictionary = new Collection.Dictionary();
somelist.add('MyKey', 'MyValue');
somelist.add('MyKey2', 'MyValue2');
somelist.toArray(); // ['MyValue', 'MyValue']
somelist.get('MyKey') // => MyValue
Tests
You can test running the following command in package's directory:
npm test