set.d.ts 1.2 KB

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