asksuite-core
Version:
14 lines (10 loc) • 345 B
JavaScript
const _ = require('lodash');
function getChildren(it) {
return _.union([it, _.map(it.children, getChildren)]);
}
function extractDialogBookingEngine(chatTree) {
return _.flattenDeep(getChildren(chatTree)).find(_.matchesProperty('type', 'booking-engine'));
}
module.exports = {
extractDialogBookingEngine: extractDialogBookingEngine,
};