@scalar/api-client
Version:
the open source API testing client
19 lines • 877 B
TypeScript
import type { JsonPath } from './json-ast.js';
type YamlNodeRange = {
startOffset: number;
endOffset: number;
};
/**
* Finds the byte range (offset) in the YAML text corresponding to a JSON path.
* Given a YAML string and a path (array of segments), parses the document and walks
* down the tree to find the target node or key, returning its start and end offsets.
* Will prefer to highlight the "key" part for map entries, to avoid highlighting the value which
* might be offset due to block structure.
*
* @param yamlText The YAML string
* @param path An array representing the path to traverse
* @returns The byte offsets in the YAML string of the node (or null if not found)
*/
export declare const getYamlNodeRangeFromPath: (yamlText: string, path: JsonPath) => YamlNodeRange | null;
export {};
//# sourceMappingURL=get-yaml-node-range-from-path.d.ts.map