aboutsummaryrefslogtreecommitdiff
path: root/node_modules/invert-kv/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/invert-kv/index.js')
-rw-r--r--node_modules/invert-kv/index.js15
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 0000000..61e2196
--- /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;
+};