UNPKG

@bookbox/core

Version:

Bookbox — e-book format

12 lines (11 loc) 323 B
export function iterableTreeGetter(options) { const { getChildren, isLeaf } = options; return function* iterableTree(schema) { for (const item of schema) { yield item; if (isLeaf(item)) continue; yield* iterableTree(getChildren(item)); } }; }