Comparing version 3.0.1 to 4.0.0
// 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', '🦄': '🌈'}); |
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
Yes
3522
31