JavaScript Multi Key Array: Set and get values from arrays using multiple keys

Recommend this page to a friend!
  Info   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 186 All time: 276 This week: 4Up
Version License JavaScript version Categories
multi-key 1.0GNU General Publi...1.0Data types
Description Author

This object can set and get values from arrays using multiple keys.

It can take an array of key names and set all the entries of those keys to the same value.

The object can also get the values of multiple array keys at once.

Innovation Award
JavaScript Programming Innovation award nominee
March 2013
Number 3
Arrays are often used to store multiple values. In some cases, multiple array entries need to be assigned to the same value.

This JavaScript object can store and retrieve multiple values in arrays at once.

Manuel Lemos
Picture of Javier Camelis
Name: Javier Camelis <contact>
Classes: 3 packages by
Country: Argentina Argentina
Age: ???
All time rank: 951 in Argentina Argentina
Week rank: 6 Up1 in Argentina Argentina Equal
Innovation award
Innovation award
Nominee: 1x

Details
multiKey ======== Let you create a multi key array map. Example: Setter and Getter -------------------------- ```javascript var map = Multikey(); map.set(['foo', 'var'], 'test1'); map.set(['foo2', 'var'], 'test2'); map.set(['foo', 'var2'], 'test3'); map.get('foo', 'var'); // return 'test1' map.get('foo2', 'var'); // return 'test2' map.get('foo', 'var2'); // return 'test3' ``` Methods: -------- set([arg1[, arg2 [, argN]]], value); ```javascript var map = Multikey(); map.set(['foo', 'var'], 'value1'); ``` get(arg1[, arg2 [, argN ] ]); ```javascript var map = Multikey(); map.get('foo', 'var'); // returns 'value1' ``` each(callback); ```javascript var map = Multikey(); map.each(function(index, mapItem){ //your script }); ``` getKeys(); ```javascript var map = Multikey(); map.set(['foo', 'var'], 'value1'); map.set(['foo1', 'var1'], 'value2'); map.set(['foo2', 'var3'], 'value3'); mar.getKeys(); // returns ['foo', 'foo1', 'foo2'] ```
  Files folder image Files  
File Role Description
Files folder imagetest (6 files, 1 directory)
Accessible without login Plain text file compile.sh Data Auxiliary data
Plain text file jcamelis.multiKey.js Class Class source
Plain text file jcamelis.multiKey.min.js Class Class source
Accessible without login Plain text file license.txt Doc. Documentation
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  test  
File Role Description
Files folder imagelib (2 files)
  Accessible without login HTML file development.html Doc. Documentation
  Accessible without login Plain text file each.js Test Unit test script
  Accessible without login Plain text file getKeys.js Test Unit test script
  Accessible without login Plain text file makeArray.js Test Unit test script
  Accessible without login HTML file minify.html Doc. Documentation
  Accessible without login Plain text file setter_getter.js Test Unit test script

  Files folder image Files  /  test  /  lib  
File Role Description
  Accessible without login Plain text file qunit-1.11.0.css Data Auxiliary data
  Accessible without login Plain text file qunit-1.11.0.js Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:186
This week:0
All time:276
This week:4Up