ValidationUtils

Created by Ely on 7/21/2014. Initial idea borrowed from Zend Framework 2's Zend/Validator

Methods

static defaultValueObscurator(x) → {String}

Default value obscurator.
Parameters:
Name Type Description
x * Value to obscurate.
Returns:
String - - Obscurated value.

static getErrorMsgByKey(options, key, value) → {String|undefined}

Gets an error message by `messageTemplates` key from `options` object.
Parameters:
Name Type Description
options Object
key String | function
value *
Returns:
String | undefined - - Error message if successfully resolved one else `undefined`.

static toValidationOptions(…options) → {Object}

Returns a strongly typed/normalized ValidatorOptions object.
Parameters:
Name Type Attributes Description
options Object <repeatable>
Returns:
Object

static toValidationResult(…options) → {*}

Returns a strongly typed, normalized validation result object.
Parameters:
Name Type Attributes Description
options Object <repeatable>
Returns:
*