UNPKG

1.27 kBTypeScriptView Raw
1import { CreateNodeContext } from '../doc/createNode.js';
2import type { CollectionItem } from '../parse/cst.js';
3import type { Schema } from '../schema/Schema.js';
4import type { StringifyContext } from '../stringify/stringify.js';
5import { addPairToJSMap } from './addPairToJSMap.js';
6import { NODE_TYPE } from './identity.js';
7import type { ToJSContext } from './toJS.js';
8export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<import("./Node.js").Node, import("./Alias.js").Alias | import("./Scalar.js").Scalar<unknown> | import("./YAMLMap.js").YAMLMap<unknown, unknown> | import("./YAMLSeq.js").YAMLSeq<unknown>>;
9export declare class Pair<K = unknown, V = unknown> {
10 readonly [NODE_TYPE]: symbol;
11 /** Always Node or null when parsed, but can be set to anything. */
12 key: K;
13 /** Always Node or null when parsed, but can be set to anything. */
14 value: V | null;
15 /** The CST token that was composed into this pair. */
16 srcToken?: CollectionItem;
17 constructor(key: K, value?: V | null);
18 clone(schema?: Schema): Pair<K, V>;
19 toJSON(_?: unknown, ctx?: ToJSContext): ReturnType<typeof addPairToJSMap>;
20 toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
21}