lowercase-keys 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -5,12 +5,10 @@ Lowercase the keys of an object.
5
5
 
6
6
  @example
7
7
  ```
8
- import lowercaseKeys = require('lowercase-keys');
8
+ import lowercaseKeys from 'lowercase-keys';
9
9
 
10
10
  lowercaseKeys({FOO: true, bAr: false});
11
11
  //=> {foo: true, bar: false}
12
12
  ```
13
13
  */
14
- declare function lowercaseKeys<T extends unknown>(object: {[key: string]: T}): {[key: string]: T};
15
-
16
- export = lowercaseKeys;
14
+ export default function lowercaseKeys<T>(object: Record<string, T>): Record<string, T>;
package/index.js CHANGED
@@ -1,10 +1,3 @@
1
- 'use strict';
2
- module.exports = object => {
3
- const result = {};
4
-
5
- for (const [key, value] of Object.entries(object)) {
6
- result[key.toLowerCase()] = value;
7
- }
8
-
9
- return result;
10
- };
1
+ export default function lowercaseKeys(object) {
2
+ return Object.fromEntries(Object.entries(object).map(([key, value]) => [key.toLowerCase(), value]));
3
+ }
package/license CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
4
 
5
5
  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:
6
6
 
package/package.json CHANGED
@@ -1,16 +1,19 @@
1
1
  {
2
2
  "name": "lowercase-keys",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Lowercase the keys of an object",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/lowercase-keys",
7
+ "funding": "https://github.com/sponsors/sindresorhus",
7
8
  "author": {
8
9
  "name": "Sindre Sorhus",
9
10
  "email": "sindresorhus@gmail.com",
10
- "url": "sindresorhus.com"
11
+ "url": "https://sindresorhus.com"
11
12
  },
13
+ "type": "module",
14
+ "exports": "./index.js",
12
15
  "engines": {
13
- "node": ">=8"
16
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
14
17
  },
15
18
  "scripts": {
16
19
  "test": "xo && ava && tsd"
@@ -31,8 +34,8 @@
31
34
  "key"
32
35
  ],
33
36
  "devDependencies": {
34
- "ava": "^1.4.1",
35
- "tsd": "^0.7.2",
36
- "xo": "^0.24.0"
37
+ "ava": "^3.15.0",
38
+ "tsd": "^0.18.0",
39
+ "xo": "^0.45.0"
37
40
  }
38
41
  }
package/readme.md CHANGED
@@ -1,32 +1,32 @@
1
- # lowercase-keys [![Build Status](https://travis-ci.org/sindresorhus/lowercase-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/lowercase-keys)
1
+ # lowercase-keys
2
2
 
3
3
  > Lowercase the keys of an object
4
4
 
5
+ Check out [`map-obj`](https://github.com/sindresorhus/map-obj) if you need support for deep iteration.
5
6
 
6
7
  ## Install
7
8
 
9
+ ```sh
10
+ npm install lowercase-keys
8
11
  ```
9
- $ npm install lowercase-keys
10
- ```
11
-
12
12
 
13
13
  ## Usage
14
14
 
15
15
  ```js
16
- const lowercaseKeys = require('lowercase-keys');
16
+ import lowercaseKeys from 'lowercase-keys';
17
17
 
18
18
  lowercaseKeys({FOO: true, bAr: false});
19
19
  //=> {foo: true, bar: false}
20
20
  ```
21
21
 
22
-
23
22
  ## API
24
23
 
25
24
  ### lowercaseKeys(object)
26
25
 
27
26
  Returns a new object with the keys lowercased.
28
27
 
28
+ ## lowercase-keys for enterprise
29
29
 
30
- ## License
30
+ Available as part of the Tidelift Subscription.
31
31
 
32
- MIT © [Sindre Sorhus](https://sindresorhus.com)
32
+ The maintainers of lowercase-keys and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-lowercase-keys?utm_source=npm-lowercase-keys&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)