mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-18 03:29:15 +00:00
fix(bot): ⚡ working nested new flow
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { flatObject } = require('../../utils/flattener')
|
||||
const { generateRef } = require('../../utils/hash')
|
||||
const { addChild } = require('./addChild')
|
||||
const { toJson } = require('./toJson')
|
||||
/**
|
||||
*
|
||||
@@ -28,9 +29,21 @@ const addAnswer =
|
||||
delay: typeof options?.delay === 'number' ? options?.delay : 0,
|
||||
})
|
||||
|
||||
const getNested = () => ({
|
||||
nested: Array.isArray(nested) ? nested : [],
|
||||
})
|
||||
const getNested = () => {
|
||||
let flatNested = []
|
||||
if (Array.isArray(nested)) {
|
||||
for (const iterator of nested) {
|
||||
flatNested = [...flatNested, ...addChild(iterator)]
|
||||
}
|
||||
|
||||
return {
|
||||
nested: flatNested,
|
||||
}
|
||||
}
|
||||
return {
|
||||
nested: addChild(nested),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Esta funcion aplana y busca los callback anidados de los hijos
|
||||
|
||||
Reference in New Issue
Block a user