UNPKG

elliptical

Version:

Interactive natural-language interfaces

35 lines (28 loc) 682 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = require('../utils'); const defaultProps = { skipIncomplete: false, option: false }; function* visit(option, _ref, traverse) { let props = _ref.props; let children = _ref.children; if (props.inbound) { if (!props.inbound(option)) { return; } } for (let output of traverse(children[0], option)) { if (props.skipIncomplete && !(0, _utils.isComplete)(output)) { yield output; } else { if (!props.outbound || props.outbound(output)) { yield output; } } } } exports.default = { defaultProps: defaultProps, visit: visit };