UNPKG

1.26 kBTypeScriptView Raw
1import { Pair } from '../../nodes/Pair';
2import type { Scalar } from '../../nodes/Scalar';
3import type { ToJSContext } from '../../nodes/toJS';
4import { YAMLMap } from '../../nodes/YAMLMap';
5import type { Schema } from '../../schema/Schema';
6import type { StringifyContext } from '../../stringify/stringify';
7import type { CreateNodeContext } from '../../util';
8import type { CollectionTag } from '../types';
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;
27}
28export declare const set: CollectionTag;