UNPKG

345 BJavaScriptView Raw
1const _ = require('lodash');
2
3function getChildren(it) {
4 return _.union([it, _.map(it.children, getChildren)]);
5}
6
7function extractDialogBookingEngine(chatTree) {
8 return _.flattenDeep(getChildren(chatTree)).find(_.matchesProperty('type', 'booking-engine'));
9}
10
11module.exports = {
12 extractDialogBookingEngine: extractDialogBookingEngine,
13};