UNPKG

1.04 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.validChars = /^[a-zA-Z0-9-_]+$/;
4exports.validCharsTeamName = /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;
5exports.isValidOpName = (opName) => typeof opName === 'string' && exports.validChars.test(opName);
6exports.isValidTeamName = (teamName) => typeof teamName === 'string' && exports.validCharsTeamName.test(teamName);
7// RFCC 5322 official standard to validate emails
8exports.validateEmail = (email) => {
9 return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email);
10};
11exports.validatePasswordFormat = (input) => {
12 if (input.length < 8)
13 return `❗ This password is too short, please choose a password that is at least 8 characters long`;
14 return true;
15};
16exports.validateCpassword = (input, answers) => {
17 if (input !== answers.password) {
18 return `❗ Password doesn't match, please try again.`;
19 }
20 return true;
21};