Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.
/ dictionaryjs Public archive

DictionaryJS, a javascript library to define dictionaries that can be indexed using any data type.

License

Notifications You must be signed in to change notification settings

nicolas-van/dictionaryjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DictionaryJS

A javascript library to define dictionaries that can be indexed using any data type. This library also provides utility methods similar to the functions provided by underscore.

Dependencies

  • Underscore 1.4.1 or superior

How to use

Include the dictionary.js script in your page. Then you can use the Dictionary class. Sample usage:

var dict = new Dictionary();

dict.set(53, 44);

console.log(dict.get(53));
// print "44"

dict.each(function(v, k) {
    console.log(typeof k, typeof v);
    // print "number number"
});

// extend can be called with dictionaries, objects or list of tuples
dict.extend(new Dictionary().set(15,18).set(34, 27),
    {"key": 57},
    [[68, 17]]);

// extend is also called during the construction
dict = new Dictionary({"key2": 56});

// you can use most underscore functions
var valsx2 = dict.map(function(v) {
    return v * 2;
});

About

DictionaryJS, a javascript library to define dictionaries that can be indexed using any data type.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published