Socket
Socket
Sign inDemoInstall

invert-kv

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

invert-kv - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

8

index.d.ts
// TODO: Extend this to symbol when TS allows symbols in index signatures:
// https://github.com/Microsoft/TypeScript/issues/1863
/**
Invert the key/value of an object. Example: `{foo: 'bar'}` → `{bar: 'foo'}`.
Invert the key/value of an object.
@example
```
import invertKeyValue = require('invert-kv');
import invertKeyValue from 'invert-kv';

@@ -14,3 +14,3 @@ invertKeyValue({foo: 'bar', '🦄': '🌈'});

*/
declare function invertKeyValue<
export default function invertKeyValue<
KeyType extends string | number,

@@ -21,3 +21,1 @@ ValueType extends string | number | symbol

): {[key in ValueType]: KeyType extends number ? Exclude<KeyType, number> | string : KeyType};
export = invertKeyValue;

@@ -1,4 +0,2 @@

'use strict';
module.exports = object => {
export default function invertKeyValue(object) {
if (typeof object !== 'object' || object === null) {

@@ -20,2 +18,2 @@ throw new TypeError('Expected an object');

return result;
};
}
{
"name": "invert-kv",
"version": "3.0.1",
"version": "4.0.0",
"description": "Invert the key/value of an object. Example: `{foo: 'bar'}` → `{bar: 'foo'}`",

@@ -13,4 +13,6 @@ "license": "MIT",

},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": ">=12"
},

@@ -33,6 +35,6 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.39.1"
}
}

@@ -1,2 +0,2 @@

# invert-kv [![Build Status](https://travis-ci.com/sindresorhus/invert-kv.svg?branch=master)](https://travis-ci.com/sindresorhus/invert-kv)
# invert-kv

@@ -14,3 +14,3 @@ > Invert the key/value of an object. Example: `{foo: 'bar'}` → `{bar: 'foo'}`

```js
const invertKeyValue = require('invert-kv');
import invertKeyValue from 'invert-kv';

@@ -17,0 +17,0 @@ invertKeyValue({foo: 'bar', '🦄': '🌈'});

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc