diff options
Diffstat (limited to 'node_modules/invert-kv/index.js')
-rw-r--r-- | node_modules/invert-kv/index.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/node_modules/invert-kv/index.js b/node_modules/invert-kv/index.js new file mode 100644 index 000000000..61e219611 --- /dev/null +++ b/node_modules/invert-kv/index.js @@ -0,0 +1,15 @@ +'use strict'; +module.exports = function (obj) { + if (typeof obj !== 'object') { + throw new TypeError('Expected an object'); + } + + var ret = {}; + + for (var key in obj) { + var val = obj[key]; + ret[val] = key; + } + + return ret; +}; |