kopia lustrzana https://github.com/c9/core
add to makefile
rodzic
cf02d0a1b8
commit
95012eb90a
|
@ -0,0 +1,9 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}, {});
|
||||||
|
};
|
Ładowanie…
Reference in New Issue