pax_global_header00006660000000000000000000000064123727354470014530gustar00rootroot0000000000000052 comment=c28c3a15abcde3f67bd90f90f8ffe54a5f8cb04e invert-kv-1.0.0/000077500000000000000000000000001237273544700134535ustar00rootroot00000000000000invert-kv-1.0.0/.editorconfig000066400000000000000000000003371237273544700161330ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [package.json] indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false invert-kv-1.0.0/.gitattributes000066400000000000000000000000141237273544700163410ustar00rootroot00000000000000* text=auto invert-kv-1.0.0/.gitignore000066400000000000000000000000151237273544700154370ustar00rootroot00000000000000node_modules invert-kv-1.0.0/.jshintrc000066400000000000000000000002761237273544700153050ustar00rootroot00000000000000{ "node": true, "esnext": true, "bitwise": true, "camelcase": true, "curly": true, "immed": true, "newcap": true, "noarg": true, "undef": true, "unused": "vars", "strict": true } invert-kv-1.0.0/.travis.yml000066400000000000000000000000461237273544700155640ustar00rootroot00000000000000language: node_js node_js: - '0.10' invert-kv-1.0.0/index.js000066400000000000000000000003451237273544700151220ustar00rootroot00000000000000'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; }; invert-kv-1.0.0/license000066400000000000000000000021371237273544700150230ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. invert-kv-1.0.0/package.json000066400000000000000000000011211237273544700157340ustar00rootroot00000000000000{ "name": "invert-kv", "version": "1.0.0", "description": "Invert the key/value of an object. Example: {foo: 'bar'} → {bar: 'foo'}", "license": "MIT", "repository": "sindresorhus/invert-kv", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "http://sindresorhus.com" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "files": [ "index.js" ], "keywords": [ "object", "obj", "key", "value", "val", "kv", "invert" ], "devDependencies": { "mocha": "*" } } invert-kv-1.0.0/readme.md000066400000000000000000000007401237273544700152330ustar00rootroot00000000000000# 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) invert-kv-1.0.0/test.js000066400000000000000000000003601237273544700147670ustar00rootroot00000000000000'use strict'; var assert = require('assert'); var invertKv = require('./'); it('should invert key/val of an object', function () { assert.deepEqual( invertKv({foo: 'bar', unicorn: 'rainbow'}), {bar: 'foo', rainbow: 'unicorn'} ); });