storj/web/satellite/src/utils/validation.ts

25 lines
556 B
TypeScript
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
/**
* Validator holds validation check methods for strings.
*/
export class Validator {
/**
* Checks string to satisfy email rules.
*/
public static email(email: string): boolean {
const rgx = /.*@.*\..*$/;
return rgx.test(email);
}
/**
* Checks string to satisfy password rules.
*/
public static password(password: string): boolean {
return typeof password !== 'undefined' && password.length >= 6;
}
}