UNPKG

lazzy.ts

Version:

Fast and lightweight library for lazy operations with iterable objects.

16 lines 456 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dfs = void 0; function* dfs(node, descending = false) { const first = descending ? "right" : "left"; const second = descending ? "left" : "right"; if (node[first] != null) { yield* dfs(node[first]); } yield node.value; if (node[second] != null) { yield* dfs(node[second]); } } exports.dfs = dfs; //# sourceMappingURL=dfs.js.map