UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

16 lines 475 B
import { UndEndIterator } from '../util/iterator'; export const walk0 = (node) => { const stack = [node]; return () => { const node = stack.pop(); if (!node) return; if (typeof node === 'string') return node; for (let i = node.length - 1; i >= 2; i--) stack.push(node[i]); return node; }; }; export const walk = (node) => new UndEndIterator(walk0(node)); //# sourceMappingURL=walk.js.map