UNPKG

@comyata/run

Version:

Simplify data workflows and management with data templates, for browser and server.

16 lines 455 B
export const walkNode = (rootNode, path) => { let currentNode = rootNode; for (const segment of path) { const c = currentNode.children; if (c) { const nextNode = c.get(segment); if (nextNode) { currentNode = nextNode; } else { // todo: if previous nodes just don't exist, return a resolver function throw new Error(`No DataNode for ${JSON.stringify(path)}`); } } } return currentNode; };