本文整理汇总了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);
}