UNPKG

973 BTypeScriptView Raw
1import { ProjectAsync } from "../Project";
2export declare type JsonManipulation = (jsonObj: any) => void;
3/**
4 * Manipulate the contents of the given JSON file within the project,
5 * using its object form and writing back using the same formatting.
6 * See the manipulate function.
7 * @param {P} p
8 * @param {string} jsonPath JSON file path. This function will do nothing
9 * without error if the file is ill-formed or not found.
10 * @param {JsonManipulation} manipulation
11 * @return {Promise<P extends ProjectAsync>}
12 */
13export declare function doWithJson<M, P extends ProjectAsync = ProjectAsync>(p: P, jsonPath: string, manipulation: JsonManipulation): Promise<P>;
14/**
15 * Update the object form of the given JSON content and write
16 * it back with minimal changes
17 * @param {string} jsonIn
18 * @param {(jsonObj: any) => Object} manipulation
19 * @return {string}
20 */
21export declare function manipulate(jsonIn: string, manipulation: JsonManipulation, context?: string): string;