Socket
Socket
Sign inDemoInstall

invert-kv

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

index.d.ts

14

index.js

@@ -7,10 +7,14 @@ 'use strict';

const ret = {};
const result = {};
for (const key of Object.keys(object)) {
const value = object[key];
ret[value] = key;
for (const [key, value] of Object.entries(object)) {
result[value] = key;
}
return ret;
for (const symbol of Object.getOwnPropertySymbols(object)) {
const value = object[symbol];
result[value] = symbol;
}
return result;
};
{
"name": "invert-kv",
"version": "2.0.0",
"version": "3.0.0",
"description": "Invert the key/value of an object. Example: `{foo: 'bar'}` → `{bar: 'foo'}`",

@@ -13,9 +13,10 @@ "license": "MIT",

"engines": {
"node": ">=4"
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],

@@ -26,9 +27,11 @@ "keywords": [

"value",
"kv",
"invert"
"invert",
"keys",
"values"
],
"devDependencies": {
"ava": "*",
"xo": "*"
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

@@ -16,6 +16,6 @@ # invert-kv [![Build Status](https://travis-ci.org/sindresorhus/invert-kv.svg?branch=master)](https://travis-ci.org/sindresorhus/invert-kv)

```js
const invertKv = require('invert-kv');
const invertKeyValue = require('invert-kv');
invertKv({foo: 'bar', unicorn: 'rainbow'});
//=> {bar: 'foo', rainbow: 'unicorn'}
invertKeyValue({foo: 'bar', '🦄': '🌈'});
//=> {bar: 'foo', '🌈': '🦄'}
```

@@ -22,0 +22,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc