UNPKG

1.28 kBTypeScriptView Raw
1import { Pair } from '../../nodes/Pair.js';
2import { Scalar } from '../../nodes/Scalar.js';
3import { ToJSContext } from '../../nodes/toJS.js';
4import { YAMLMap } from '../../nodes/YAMLMap.js';
5import type { Schema } from '../../schema/Schema.js';
6import type { StringifyContext } from '../../stringify/stringify.js';
7import { CreateNodeContext } from '../../util.js';
8import type { CollectionTag } from '../types.js';
9export declare class YAMLSet<T = unknown> extends YAMLMap<T, Scalar<null> | null> {
10 static tag: string;
11 constructor(schema?: Schema);
12 add(key: T | Pair<T, Scalar<null> | null> | {
13 key: T;
14 value: Scalar<null> | null;
15 }): void;
16 /**
17 * If `keepPair` is `true`, returns the Pair matching `key`.
18 * Otherwise, returns the value of that Pair's key.
19 */
20 get(key: unknown, keepPair?: boolean): any;
21 set(key: T, value: boolean): void;
22 /** @deprecated Will throw; `value` must be boolean */
23 set(key: T, value: null): void;
24 toJSON(_?: unknown, ctx?: ToJSContext): any;
25 toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
26 static from(schema: Schema, iterable: unknown, ctx: CreateNodeContext): YAMLSet<unknown>;
27}
28export declare const set: CollectionTag;