2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-27 10:51:33 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2020-06-02 15:08:20 +01:00
|
|
|
/**
|
|
|
|
* Validator holds validation check methods for strings.
|
|
|
|
*/
|
|
|
|
export class Validator {
|
2018-11-05 15:26:18 +00:00
|
|
|
|
2020-06-02 15:08:20 +01:00
|
|
|
/**
|
|
|
|
* Checks string to satisfy email rules.
|
|
|
|
*/
|
|
|
|
public static email(email: string): boolean {
|
|
|
|
const rgx = /.*@.*\..*$/;
|
2018-12-27 12:05:38 +00:00
|
|
|
|
2020-06-02 15:08:20 +01:00
|
|
|
return rgx.test(email);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks string to satisfy password rules.
|
|
|
|
*/
|
|
|
|
public static password(password: string): boolean {
|
|
|
|
return typeof password !== 'undefined' && password.length >= 6;
|
|
|
|
}
|
2020-04-28 13:26:32 +01:00
|
|
|
}
|