Comparing version 1.0.0 to 2.0.0
12
index.js
'use strict'; | ||
module.exports = function (obj) { | ||
if (typeof obj !== 'object') { | ||
module.exports = object => { | ||
if (typeof object !== 'object') { | ||
throw new TypeError('Expected an object'); | ||
} | ||
var ret = {}; | ||
const ret = {}; | ||
for (var key in obj) { | ||
var val = obj[key]; | ||
ret[val] = key; | ||
for (const key of Object.keys(object)) { | ||
const value = object[key]; | ||
ret[value] = key; | ||
} | ||
@@ -13,0 +13,0 @@ |
{ | ||
"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": "*" | ||
} | ||
"name": "invert-kv", | ||
"version": "2.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": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"object", | ||
"key", | ||
"value", | ||
"kv", | ||
"invert" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
@@ -8,5 +8,5 @@ # invert-kv [![Build Status](https://travis-ci.org/sindresorhus/invert-kv.svg?branch=master)](https://travis-ci.org/sindresorhus/invert-kv) | ||
```sh | ||
$ npm install --save invert-kv | ||
``` | ||
$ npm install invert-kv | ||
``` | ||
@@ -17,3 +17,3 @@ | ||
```js | ||
var invertKv = require('invert-kv'); | ||
const invertKv = require('invert-kv'); | ||
@@ -27,2 +27,2 @@ invertKv({foo: 'bar', unicorn: 'rainbow'}); | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2376
4
2