Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
super();
const lgFilePath = path.join(__dirname, './resources/main.lg');
// add the custom function
Expression.functions.add(mySqrtFnName, (args) => {
let retValue = null;
if (args[0] !== null) {
try {
const dblValue = parseFloat(args[0]);
retValue = Math.sqrt(dblValue);
} catch (ex) {
return retValue;
}
}
return retValue;
});
// by default this uses Expression.functions.
this.lgTemplates = Templates.parseFile(lgFilePath);
// See https://aka.ms/about-bot-activity-message to learn more about the message and other activity types.