Login   Register  
Icontem

File: README.md

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Javier Camelis  >  JavaScript Multi Key Array  >  README.md  >  Download  
File: README.md
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: Change constructor.
Documentation added.
Documentation added.
Date: 2013-04-26 08:21
Size: 964 bytes
 

Contents

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']
```