createNode.d.ts 674 B

1234567891011121314151617
  1. import type { Node } from '../nodes/Node.js';
  2. import type { Schema } from '../schema/Schema.js';
  3. import type { CollectionTag, ScalarTag } from '../schema/types.js';
  4. import type { Replacer } from './Document.js';
  5. export interface CreateNodeContext {
  6. aliasDuplicateObjects: boolean;
  7. keepUndefined: boolean;
  8. onAnchor: (source: unknown) => string;
  9. onTagObj?: (tagObj: ScalarTag | CollectionTag) => void;
  10. sourceObjects: Map<unknown, {
  11. anchor: string | null;
  12. node: Node | null;
  13. }>;
  14. replacer?: Replacer;
  15. schema: Schema;
  16. }
  17. export declare function createNode(value: unknown, tagName: string | undefined, ctx: CreateNodeContext): Node;