1.7.3 • Published 6 months ago
@types/edit-json-file v1.7.3
Installation
npm install --save @types/edit-json-file
Summary
This package contains type definitions for edit-json-file (https://github.com/IonicaBizau/edit-json-file#readme).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/edit-json-file.
index.d.ts
// Type definitions for edit-json-file 1.7
// Project: https://github.com/IonicaBizau/edit-json-file#readme
// Definitions by: Twixes <https://github.com/Twixes>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types= "node" />
import { NoParamCallback } from 'fs';
import * as set from 'set-value';
declare namespace editJsonFile {
/** JSON file editor options. */
interface Options {
stringify_width?: number | undefined;
stringify_fn?: ((data: object) => string) | undefined;
stringify_eol?: boolean | undefined;
autosave?: boolean | undefined;
ignore_dots?: boolean | undefined;
}
/** JSON file editor. */
interface JsonEditor {
/** Get value at path. */
get(path?: string): any;
/** Set value at path. */
set(path: string, value: any, options?: set.Options): JsonEditor;
/** Appends a value/object to a specific path. */
append(path: string, value: any): JsonEditor;
/** Pop an array from a specific path. */
pop(path: string): JsonEditor;
/** Unset value at path. */
unset(path: string): JsonEditor;
/** Read the JSON file. */
read(cb?: NoParamCallback): object;
/** Overwrite the JSON file. */
write(content: string, cb?: NoParamCallback): JsonEditor;
/** Empty the JSON file. */
empty(cb?: NoParamCallback): JsonEditor;
/** Save the JSON file back to disk. */
save(cb?: NoParamCallback): JsonEditor;
/** Get full object. */
toObject(): object;
}
}
/** Create a JSON file editor. */
declare function editJsonFile(path: string, options?: editJsonFile.Options): editJsonFile.JsonEditor;
export = editJsonFile;
Additional Details
- Last updated: Wed, 12 Jan 2022 15:01:30 GMT
- Dependencies: @types/set-value, @types/node
- Global values: none
Credits
These definitions were written by Twixes.