load-json-file
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -1,2 +0,2 @@ | ||
export type Reviver = (key: string, value: any) => any; | ||
export type Reviver = (this: unknown, key: string, value: unknown) => unknown; | ||
export type BeforeParse = (data: string) => string; | ||
@@ -8,3 +8,4 @@ | ||
*/ | ||
beforeParse?: BeforeParse; | ||
readonly beforeParse?: BeforeParse; | ||
/** | ||
@@ -14,3 +15,3 @@ * Prescribes how the value originally produced by parsing is transformed, before being returned. | ||
*/ | ||
reviver?: Reviver; | ||
readonly reviver?: Reviver; | ||
} | ||
@@ -25,8 +26,10 @@ | ||
* | ||
* import * as loadJsonFile from 'load-json-file'; | ||
* import loadJsonFile from 'load-json-file'; | ||
* | ||
* const json = loadJsonFile.sync('foo.json'); | ||
* //=> {foo: true} | ||
* (async () => { | ||
* const json = await loadJsonFile('foo.json'); | ||
* //=> {foo: true} | ||
* })(); | ||
*/ | ||
export function sync<T = unknown>(filePath: string, options?: Options): T; | ||
export default function loadJsonFile<T = unknown>(filePath: string, options?: Options): Promise<T>; | ||
@@ -40,9 +43,7 @@ /** | ||
* | ||
* import loadJsonFile from 'load-json-file'; | ||
* import * as loadJsonFile from 'load-json-file'; | ||
* | ||
* (async () => { | ||
* const json = await loadJsonFile('foo.json'); | ||
* //=> {foo: true} | ||
* })(); | ||
* const json = loadJsonFile.sync('foo.json'); | ||
* //=> {foo: true} | ||
*/ | ||
export default function loadJsonFile<T = unknown>(filePath: string, options?: Options): Promise<T>; | ||
export function sync<T = unknown>(filePath: string, options?: Options): T; |
{ | ||
"name": "load-json-file", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "Read and parse a JSON file", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
5192