Skip to content

A javascript collection list Object for enhancing array and search capabilities

License

Notifications You must be signed in to change notification settings

konstantinos-tsatsarounos/collectionjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A javascript collection list Object for enhancing array and search capabilities

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published