@atlaskit/adf-utils
Version:
Set of utilities to traverse, modify and create ADF documents.
13 lines (12 loc) • 690 B
TypeScript
import type { ADFEntity, VisitorCollection } from '../types';
export declare function validateVisitors(_visitors: VisitorCollection): boolean;
/**
* Provides recursive, depth-first search document traversal. Use visitors collection to define nodes of interest.
* If no visitor for given node is defined, no-op happens.
* If visitor returns new node, the old node is replaced.
* If visitor returns false, node is dropped from the document.
* If visitor returns null/undefined/void, original node is used.
* @param adf Document to traverse.
* @param visitors Collection of visitors.
*/
export declare function traverse(adf: ADFEntity, visitors: VisitorCollection): false | ADFEntity;