write-json-file
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -1,4 +0,4 @@ | ||
export type Replacer = (key: string, value: any) => number | string | boolean | object | null | undefined; | ||
export type Replacer = (this: unknown, key: string, value: unknown) => unknown; | ||
export type SortKeys = (a: string, b: string) => number; | ||
export type JSONStringifyable = object | number | string | boolean; | ||
export type JSONStringifyable = string | number | boolean | null | object; | ||
@@ -11,3 +11,4 @@ export interface Options { | ||
*/ | ||
indent?: string | number | null; | ||
readonly indent?: string | number | null; | ||
/** | ||
@@ -18,3 +19,4 @@ * Detect indentation automatically if the file exists. | ||
*/ | ||
detectIndent?: boolean; | ||
readonly detectIndent?: boolean; | ||
/** | ||
@@ -25,7 +27,9 @@ * Sort the keys recursively. Optionally pass in a compare function. | ||
*/ | ||
sortKeys?: boolean | SortKeys; | ||
readonly sortKeys?: boolean | SortKeys; | ||
/** | ||
* Passed into `JSON.stringify`. | ||
*/ | ||
replacer?: Replacer | Array<number | string>; | ||
readonly replacer?: Replacer | Array<number | string>; | ||
/** | ||
@@ -36,3 +40,3 @@ * Mode used when writing the file. | ||
*/ | ||
mode?: number; | ||
readonly mode?: number; | ||
} | ||
@@ -39,0 +43,0 @@ |
@@ -52,3 +52,2 @@ 'use strict'; | ||
const file = fs.readFileSync(filePath, 'utf8'); | ||
// eslint-disable-next-line prefer-destructuring | ||
indent = detectIndent(file).indent; | ||
@@ -55,0 +54,0 @@ } catch (error) { |
{ | ||
"name": "write-json-file", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "Stringify and write JSON to a file atomically", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
7273
120