c9-core/node_modules/c9/object.js

9 wiersze
196 B
JavaScript
Czysty Zwykły widok Historia

2015-10-20 10:47:14 +00:00
/*
* Swap keys and values of an object
*/
exports.invert = function(obj) {
return Object.keys(obj).reduce(function(res, key) {
res[obj[key]] = key;
return res;
}, {});
};