add Ox.zipObject
This commit is contained in:
parent
f01456e475
commit
b10d454d2c
1 changed files with 13 additions and 0 deletions
|
@ -202,3 +202,16 @@ Ox.unserialize = function(string, isJSON) {
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*@
|
||||||
|
Ox.zipObject <f> Takes a keys and a values array, returns a new object
|
||||||
|
> Ox.zipObject(['a', 'b'], [1, 2])
|
||||||
|
{a: 1, b: 2}
|
||||||
|
@*/
|
||||||
|
Ox.zipObject = function(keys, values) {
|
||||||
|
var object = {};
|
||||||
|
keys.forEach(function(key, index) {
|
||||||
|
object[key] = values[index];
|
||||||
|
});
|
||||||
|
return object;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue