UNPKG

botbuilder-dialogs-adaptive

Version:

Rule system for the Microsoft BotBuilder dialog system.

61 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IntentPattern = void 0; /** * @module botbuilder-dialogs-adaptive */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ class IntentPattern { /** * Initializes a new instance of the [IntentPattern](xref:botbuilder-dialogs-adaptive.IntentPattern) class. * * @param intent The intent. * @param pattern The regex pattern to match.. */ constructor(intent, pattern) { if (intent && pattern) { this.intent = intent; this.pattern = pattern; } } /** * @returns An instance of RegExp with the given pattern. */ get regex() { // eslint-disable-next-line security/detect-non-literal-regexp return new RegExp(this._pattern, 'ig'); } /** * Gets the intent. * * @returns The intent. */ get intent() { return this._intent; } /** * Sets the intent. */ set intent(value) { this._intent = value[0] == '#' ? value.substr(1) : value; } /** * Gets the pattern. * * @returns The pattern. */ get pattern() { return this._pattern; } /** * Sets the pattern */ set pattern(value) { this._pattern = value.startsWith('(?i)') ? value.substr(4) : value; } } exports.IntentPattern = IntentPattern; //# sourceMappingURL=intentPattern.js.map