collection-util-js

1.5.9 • Public • Published

CollectionJS - Javascript dictionary library v1.5.9

Build Status

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

Package Sidebar

Install

npm i collection-util-js

Weekly Downloads

0

Version

1.5.9

License

MIT

Last publish

Collaborators

  • infogeek