How to use the adaptive-expressions.ReturnType.Number function in adaptive-expressions

To help you get started, we’ve selected a few adaptive-expressions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotBuilder-Samples / experimental / adaptive-tool / src / lg / buildinFunctions.ts View on Github external
this.params = params;
    this.returntype = returntype;
    this.introduction = introduction;
  }
  public params: string[];
  public returntype: ReturnType;
  public introduction: string;
}

// https://github.com/microsoft/BotBuilder-Samples/blob/master/experimental/common-expression-language/prebuilt-functions.md
export const buildInfunctionsMap: Map = new Map([
  [
    'add',
    new FunctionEntity(
      ['num1: number', 'num2: number'],
      ReturnType.Number,
      'Return the result from adding two numbers.'
    ),
  ],
  [
    'div',
    new FunctionEntity(
      ['dividend: number', 'divisor: number'],
      ReturnType.Number,
      'Return the integer result from dividing two numbers. To get the remainder result, see mod().'
    ),
  ],
  [
    'mod',
    new FunctionEntity(
      ['dividend: number', 'divisor: number'],
      ReturnType.Number,
github microsoft / BotBuilder-Samples / experimental / adaptive-tool / src / lg / util.ts View on Github external
export function getreturnTypeStrFromReturnType(returnType: ReturnType): string {
    let result = '';
    switch(returnType) {
        case ReturnType.Boolean: result = "boolean";break;
        case ReturnType.Number: result = "number";break;
        case ReturnType.Object: result = "any";break;
        case ReturnType.String: result = "string";break;
        case ReturnType.Array: result = "array";break;
    }

    return result;
}
github microsoft / BotBuilder-Samples / experimental / adaptive-tool / src / lg / buildinFunctions.ts View on Github external
['timestamp: string', 'seconds: number', 'format?: string'],
      ReturnType.String,
      'Add specified number of seconds to a given timestamp'
    ),
  ],
  [
    'dayOfMonth',
    new FunctionEntity(
      ['timestamp: string'],
      ReturnType.Number,
      'Returns day of month for a given timestamp or timex expression.'
    ),
  ],
  [
    'dayOfWeek',
    new FunctionEntity(['timestamp: string'], ReturnType.Number, 'Return the day of the week from a timestamp.'),
  ],
  [
    'dayOfYear',
    new FunctionEntity(['timestamp: string'], ReturnType.Number, 'Return the day of the year from a timestamp.'),
  ],
  ['month', new FunctionEntity(['timestamp: string'], ReturnType.Number, 'Returns the month of given timestamp')],
  [
    'date',
    new FunctionEntity(
      ['timestamp: string'],
      ReturnType.Number,
      'Return the date of a specified timestamp in "M/dd/yyyy" format.'
    ),
  ],
  ['year', new FunctionEntity(['timestamp: string'], ReturnType.Number, 'Returns year for the given timestamp')],
  ['utcNow', new FunctionEntity(['format?: string'], ReturnType.String, 'Returns current timestamp as string')],