Recommend this page to a friend!
  Classes of Javier Camelis   JavaScript Multi Key Array   Download  
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: JavaScript Multi Key Array
Set and get values from arrays using multiple keys
Author: By
Last change: Update of
Date: 1 year ago
Size: 964 bytes


Class file image Download
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'] ```