Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let txt: string = (text || '');
txt += ' ';
ChoiceFactory.toChoices(choices).forEach((choice: any, index: number) => {
const title: string = choice.action && choice.action.title ? choice.action.title : choice.value;
// tslint:disable-next-line:prefer-template
txt += `${ connector }${ opt.includeNumbers ? '(' + (index + 1).toString() + ') ' : '' }${ title }`;
if (index === (choices.length - 2)) {
connector = (index === 0 ? opt.inlineOr : opt.inlineOrMore) || '';
} else {
connector = opt.inlineSeparator || '';
}
});
txt += '';
// Return activity with choices as an inline list.
return MessageFactory.text(txt, speak, InputHints.ExpectingInput);
}
...options
} as ChoiceFactoryOptions;
// Format list of choices
let connector = '';
let txt: string = (text || '');
txt += '\n\n ';
ChoiceFactory.toChoices(choices).forEach((choice: any, index: number) => {
const title: string = choice.action && choice.action.title ? choice.action.title : choice.value;
// tslint:disable-next-line:prefer-template
txt += `${ connector }${ opt.includeNumbers ? (index + 1).toString() + '. ' : '- ' }${ title }`;
connector = '\n ';
});
// Return activity with choices as a numbered list.
return MessageFactory.text(txt, speak, InputHints.ExpectingInput);
}
private static buildActivityFromText(text: string): Partial {
return MessageFactory.text(text, text);
}