本文整理匯總了TypeScript中email-validator.validate函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript validate函數的具體用法?TypeScript validate怎麽用?TypeScript validate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了validate函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
validate: (value: any) => {
if (value === "" || emailValidator.validate(value)) {
return true;
}
return "Please provide a valid e-mail or simply leave it blank.";
}
示例2: signin
signin(email:string){
console.info(email);
if(!validator.validate(email)){
alert("invalid email address");
}
this._router.navigate(["Home"]);
}
示例3: isValid
/**
* Is email valid.
*/
public isValid(): boolean {
return !!(
validate(this.to) &&
this.subject &&
this.text &&
this.html
);
}
示例4: validateUser
validateUser(processType) {
let phoneRegex: any = /^[0-9]{10}$/;
if (!validator.validate(this.email)) {
return false;
} else if (!this.password) {
return false;
}
else if (processType && processType === "signUp" && (!phoneRegex.test(this.phone) || !this.name)) {
return false;
} else {
return true;
}
}
示例5: isValid
isValid() {
return validator.validate(this.email);
}
示例6: require
/// <reference path="email-validator.d.ts" />
import emailValidator = require('email-validator');
import { validate } from 'email-validator';
var result: boolean;
// Trivial code requires trivial tests
result = validate('some email');
result = validate(null);
result = emailValidator.validate('some email');
result = emailValidator.validate(null);
示例7: isValidEmail
/**
* Validate the user email.
*/
public isValidEmail(): boolean {
return validate(this.email);
}
示例8: isValid
isValid(): boolean {
return validator.validate(this.email);
}