1
>
/*---------------------------------------------------------------------------------------------
jsonEdit.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { findNodeAtLocation, JSONPath, Node, ParseError, parseTree, Segment } from './json.js';
7
>
import { Edit, format, FormattingOptions, isEOL } from './jsonFormatter.js';
8
>
9
>
10
>
export function removeProperty(text: string, path: JSONPath, formattingOptions: FormattingOptions): Edit[] {
11
return setProperty(text, path, undefined, formattingOptions);
12
}
14
>
export function setProperty(text: string, originalPath: JSONPath, value: unknown, formattingOptions: FormattingOptions, getInsertionIndex?: (properties: string[]) => number): Edit[] {
15
const path = originalPath.slice();
16
const errors: ParseError[] = [];