UNPKG

1.42 kBJavaScriptView Raw
1'use strict';
2module.exports = {
3 /**
4 * @returns {boolean} whether given name is correct or not.
5 * Each name must consist only of lowercase and uppercase letters
6 */
7 isNameValid: (name) => /^[a-zA-Z]+$/.test(name),
8
9 /**
10 * @returns {boolean} whether given utterance is correct or not.
11 * Each sample utterance must consist only of alphabets, white-spaces and valid
12 * punctuation marks. Valid punctuation marks are periods for abbreviations,
13 * possesive apostrophes, hyphens and brackets for slots.
14 * @see https://developer.amazon.com/appsandservices/solutions/alexa/alexa-skills-kit/docs/defining-the-voice-interface
15 */
16 isUtteranceValid: (utterance) => /^[a-z\s.'\-{}]*$/gmi.test(utterance),
17
18 /**
19 * @returns {boolean} whether given custom slot name is correct or not.
20 * Each custom slot name must consist only of lowercase, uppercase letters and underscores
21 */
22 isCustomSlotNameValid: (name) => /^[a-zA-Z_]+$/.test(name),
23
24 /**
25 * @returns {boolean} whether given custom slot value is correct or not.
26 * Each custom slot value must not include special characters as ~, ^, *, (, ), [, ], §, !, ?, ;, :, " and |
27 * @see https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interaction-model-reference#h2_custom_syntax
28 */
29 isCustomSlotValueValid: (value) => /[~^*()[\]§!?;:"|]+$/gmi.test(value)
30};