-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require Node.js 12.20 and move to ESM
- Loading branch information
1 parent
5966010
commit c3d4e47
Showing
8 changed files
with
23 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
'use strict'; | ||
module.exports = object => { | ||
const result = {}; | ||
|
||
for (const [key, value] of Object.entries(object)) { | ||
result[key.toLowerCase()] = value; | ||
} | ||
|
||
return result; | ||
}; | ||
export default function lowercaseKeys(object) { | ||
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key.toLowerCase(), value])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {expectType} from 'tsd'; | ||
import lowercaseKeys = require('.'); | ||
import lowercaseKeys from './index.js'; | ||
|
||
expectType<{[key: string]: boolean}>(lowercaseKeys({FOO: true, bAr: false})); | ||
expectType<{[key: string]: string | number}>(lowercaseKeys({foo: 'bar', baz: 1})); | ||
expectType<Record<string, boolean>>(lowercaseKeys({FOO: true, bAr: false})); // eslint-disable-line @typescript-eslint/naming-convention | ||
expectType<Record<string, string | number>>(lowercaseKeys({foo: 'bar', baz: 1})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters