diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
---|---|---|
committer | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
commit | 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch) | |
tree | c7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/invert-kv | |
parent | 412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff) | |
download | website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip |
build: Add some required modules for node
Diffstat (limited to 'node_modules/invert-kv')
-rw-r--r-- | node_modules/invert-kv/index.js | 15 | ||||
-rw-r--r-- | node_modules/invert-kv/package.json | 69 | ||||
-rw-r--r-- | node_modules/invert-kv/readme.md | 25 |
3 files changed, 109 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; +}; diff --git a/node_modules/invert-kv/package.json b/node_modules/invert-kv/package.json new file mode 100644 index 0000000..7d66cf9 --- /dev/null +++ b/node_modules/invert-kv/package.json @@ -0,0 +1,69 @@ +{ + "_args": [ + [ + "invert-kv@1.0.0", + "/home/dstaesse/git/website" + ] + ], + "_development": true, + "_from": "invert-kv@1.0.0", + "_id": "invert-kv@1.0.0", + "_inBundle": false, + "_integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "_location": "/invert-kv", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "invert-kv@1.0.0", + "name": "invert-kv", + "escapedName": "invert-kv", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/lcid" + ], + "_resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "_spec": "1.0.0", + "_where": "/home/dstaesse/git/website", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/invert-kv/issues" + }, + "description": "Invert the key/value of an object. Example: {foo: 'bar'} → {bar: 'foo'}", + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/invert-kv#readme", + "keywords": [ + "object", + "obj", + "key", + "value", + "val", + "kv", + "invert" + ], + "license": "MIT", + "name": "invert-kv", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/invert-kv.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.0.0" +} diff --git a/node_modules/invert-kv/readme.md b/node_modules/invert-kv/readme.md new file mode 100644 index 0000000..039fc7c --- /dev/null +++ b/node_modules/invert-kv/readme.md @@ -0,0 +1,25 @@ +# invert-kv [![Build Status](https://travis-ci.org/sindresorhus/invert-kv.svg?branch=master)](https://travis-ci.org/sindresorhus/invert-kv) + +> Invert the key/value of an object. Example: `{foo: 'bar'}` → `{bar: 'foo'}` + + +## Install + +```sh +$ npm install --save invert-kv +``` + + +## Usage + +```js +var invertKv = require('invert-kv'); + +invertKv({foo: 'bar', unicorn: 'rainbow'}); +//=> {bar: 'foo', rainbow: 'unicorn'} +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) |