17 lines
284 B
JavaScript
17 lines
284 B
JavaScript
var zipObject = function (keys, values) {
|
|
if (arguments.length == 1) {
|
|
values = keys[1];
|
|
keys = keys[0];
|
|
}
|
|
|
|
var result = {};
|
|
var i = 0;
|
|
|
|
for (i; i < keys.length; i += 1) {
|
|
result[keys[i]] = values[i];
|
|
}
|
|
|
|
return result;
|
|
};
|
|
|
|
module.exports = zipObject; |