UNPKG

yaml-diff-patch

Version:

Apply a JSON diff/patch to YAML while preserving whitespace, comments and overall structure

11 lines (10 loc) 790 B
import { Scalar, YAMLMap, YAMLSeq } from 'yaml'; import { NodeBase } from 'yaml/dist/nodes/Node'; export declare type NodeType = Scalar | YAMLMap | YAMLSeq | null; export declare function isYamlMap(value: NodeType): value is YAMLMap; export declare function isYamlSeq(value: NodeType): value is YAMLSeq; export declare function isScalar(value: any): value is null | boolean | number | string; export declare function toAstValue(value: any): YAMLMap<unknown, unknown> | YAMLSeq<unknown> | Scalar<string | number | boolean | null>; export declare function copyProperties<T extends NodeBase>(target: NonNullable<T>, source: NonNullable<T>): void; export declare function cloneNode<T extends NodeType>(node: T): T; export declare function parseSafeIndex(index: string, length: number): number;