Typend
Hierarchy
- Typend
Implements
- Library
- Library
Index
Constructors
Properties
Methods
- debug
- getConverter
- getDescriber
- getValidator
- isInstanceOf
- isValid
- setConverter
- setDescriber
- setValidator
- validate
Constructors
constructor
+ new Typend(converter
: Converter, describer
: Describer, validator
: Validator): Typend
Creates an instance of Typend. Creates an instance of Typend.
Parameters:
Name | Type | Description |
---|---|---|
converter | Converter | Conversion library matching Converter interface. |
describer | Describer | Description library matching Describer interface. |
validator | Validator | Validation library matching Validator interface. |
Returns: Typend
Properties
converter
• converter: Converter
Implementation of Library.converter
describer
• describer: Describer
Implementation of Library.describer
validator
• validator: Validator
Implementation of Library.validator
Methods
debug
▸ debug(isDebugging?
: boolean): void
Implementation of Library
Setup debugging mode on Typend.
Parameters:
Name | Type | Description |
---|---|---|
isDebugging? | boolean | Boolean flags indicating that debugging should be enabled. |
Returns: void
getConverter
▸ getConverter(): Converter
Implementation of Library
Returns converting library.
Returns: Converter
Converter library instance.
getDescriber
▸ getDescriber(): Describer
Implementation of Library
Returns describing library.
Returns: Describer
Describer library instance.
getValidator
▸ getValidator(): Validator
Implementation of Library
Returns validator library.
Returns: Validator
Validator library instance.
isInstanceOf
▸ isInstanceOf(value
: any, expectation
: any): boolean
Validates if a value is instance of expectation.
Parameters:
Name | Type | Description |
---|---|---|
value | any | Value that needs to validated. |
expectation | any | Expectation as explicit Class , InstanceOf , Interface pattern instance against which value will be validated. |
Returns: boolean
Returns true
if validation is successful, else false
.
isValid
▸ isValid(value
: any, expectation
: Expectation | Utility, isStrict?
: boolean): boolean
Implementation of Library
Validates if a value matches an expectation.
Parameters:
Name | Type | Description |
---|---|---|
value | any | Value that needs to validated. |
expectation | Expectation | Utility | Expectation as explicit Pattern instance, instance of Utility or implicit expectation against which value will be validated. |
isStrict? | boolean | Flag indicating that evaluation should be done in strict mode. |
Returns: boolean
Returns true
if validation is successful, else false
.
setConverter
▸ setConverter(converter
: Converter): void
Implementation of Library
Sets converting library.
Parameters:
Name | Type | Description |
---|---|---|
converter | Converter | Description library matching Describer interface. |
Returns: void
setDescriber
▸ setDescriber(describer
: Describer): void
Implementation of Library
Sets describing library.
Parameters:
Name | Type | Description |
---|---|---|
describer | Describer | Conversion library matching Converter interface. |
Returns: void
setValidator
▸ setValidator(validator
: Validator): void
Implementation of Library
Sets validator library.
Parameters:
Name | Type | Description |
---|---|---|
validator | Validator | Validation library matching Validator interface. |
Returns: void
validate
▸ validate(value
: any, expectation
: Expectation | Utility, isStrict?
: boolean): boolean
Implementation of Library
Validates if a value matches an expectation or throws.
throws
{ValidationError}
Thrown if the value does not match provided expectation.
Parameters:
Name | Type | Description |
---|---|---|
value | any | Value that needs to validated. |
expectation | Expectation | Utility | Expectation as explicit Pattern instance, instance of Utility or implicit expectation against which value will be validated. |
isStrict? | boolean | Flag indicating that evaluation should be done in strict mode. |
Returns: boolean
Returns true
if validation is successful, else throws.