UNPKG

composite-validation

Version:
26 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class CompositeValidationOptions { /** * Returns error by key. * @param key Error message key. */ static errorMatch(key) { return CompositeValidationOptions._errorMatches[key] || CompositeValidationOptions.defaultError; } /** * Set default errors map. * @param value Key value pairs object ('errorKey': 'error Message'). */ static setErrorMatches(value) { CompositeValidationOptions._errorMatches = Object.assign(CompositeValidationOptions._errorMatches, value); } } CompositeValidationOptions.defaultError = 'Value is not valid'; CompositeValidationOptions._errorMatches = { required: 'Value should be defined', equals: 'Value should be equal to {$0}', invalid: CompositeValidationOptions.defaultError }; exports.CompositeValidationOptions = CompositeValidationOptions; //# sourceMappingURL=composite-validation-options.js.map