Change the first character of all end-of-line comments to upper case
This commit is contained in:
@ -19,7 +19,7 @@ export class ValidationService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
generate(method, args) { // generate a Validator function
|
||||
generate(method, args) { // Generate a Validator function
|
||||
return (control: AbstractControl): {[key: string]: any} | null => {
|
||||
let ok;
|
||||
let error;
|
||||
@ -63,7 +63,7 @@ export class ValidationService {
|
||||
return {ok: true, error: ''};
|
||||
}
|
||||
|
||||
stringOf(data, list) { // string must be in list
|
||||
stringOf(data, list) { // String must be in list
|
||||
const {ignore, error} = Joi.string().allow('').valid(...list.map(e => e.toString())).validate(data);
|
||||
if (error) {
|
||||
return {ok: false, error: 'must be one of ' + list.join(', ')};
|
||||
@ -71,7 +71,7 @@ export class ValidationService {
|
||||
return {ok: true, error: ''};
|
||||
}
|
||||
|
||||
stringNin(data, list) { // string must not be in list
|
||||
stringNin(data, list) { // String must not be in list
|
||||
const {ignore, error} = Joi.string().invalid(...list).validate(data);
|
||||
if (error) {
|
||||
return {ok: false, error: 'value not allowed'};
|
||||
@ -79,7 +79,7 @@ export class ValidationService {
|
||||
return {ok: true, error: ''};
|
||||
}
|
||||
|
||||
stringLength(data, length) { // string with maximum length
|
||||
stringLength(data, length) { // String with maximum length
|
||||
const {ignore, error} = Joi.string().max(length).allow('').validate(data);
|
||||
if (error) {
|
||||
return {ok: false, error: 'must contain max ' + length + ' characters'};
|
||||
@ -87,7 +87,7 @@ export class ValidationService {
|
||||
return {ok: true, error: ''};
|
||||
}
|
||||
|
||||
minMax(data, min, max) { // number between min and max
|
||||
minMax(data, min, max) { // Number between min and max
|
||||
const {ignore, error} = Joi.number().allow('').min(min).max(max).validate(data);
|
||||
if (error) {
|
||||
return {ok: false, error: `must be between ${min} and ${max}`};
|
||||
@ -95,7 +95,7 @@ export class ValidationService {
|
||||
return {ok: true, error: ''};
|
||||
}
|
||||
|
||||
min(data, min) { // number above min
|
||||
min(data, min) { // Number above min
|
||||
const {ignore, error} = Joi.number().allow('').min(min).validate(data);
|
||||
if (error) {
|
||||
return {ok: false, error: `must not be below ${min}`};
|
||||
@ -103,7 +103,7 @@ export class ValidationService {
|
||||
return {ok: true, error: ''};
|
||||
}
|
||||
|
||||
max(data, max) { // number below max
|
||||
max(data, max) { // Number below max
|
||||
const {ignore, error} = Joi.number().allow('').max(max).validate(data);
|
||||
if (error) {
|
||||
return {ok: false, error: `must not be above ${max}`};
|
||||
|
Reference in New Issue
Block a user