Socket
Socket
Sign inDemoInstall

write-json-file

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

write-json-file - npm Package Compare versions

Comparing version 3.0.2 to 3.1.0

18

index.d.ts

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc