Skip to main content

@webda/coreReadme | API


Class: RegExpStringValidator

Standardized way to allow string/regex validation within configuration

If url is prefixed with regex: it is considered a regex

Example

class MyServiceParameters extends ServiceParameters {
urls: string[];
}

class MyService extends Service {
loadParameters(params:any) {
const parameters = new MyServiceParameters(params);
this.urlsValidator = new RegExpStringValidator(parameters.urls);
return parameters;
}
}

Extends

Constructors

new RegExpStringValidator(info)

new RegExpStringValidator(info): RegExpStringValidator

Parameters

info: string | string[]

Returns

RegExpStringValidator

Overrides

RegExpValidator.constructor

Source

packages/core/src/services/service.ts:228

Properties

stringValidators

stringValidators: string[]

Source

packages/core/src/services/service.ts:227


validators

protected validators: RegExp[]

Inherited from

RegExpValidator.validators

Source

packages/core/src/services/service.ts:186

Methods

validate()

validate(value): boolean

Add string validation

Parameters

value: string

Returns

boolean

Overrides

RegExpValidator.validate

Source

packages/core/src/services/service.ts:239


getRegExp()

static getRegExp(reg): RegExp

Parameters

reg: string

Returns

RegExp

Inherited from

RegExpValidator.getRegExp

Source

packages/core/src/services/service.ts:192