UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

53 lines (46 loc) 1.06 kB
// Generated by github.com/steida/coffee2closure 900.1.18 /** @fileoverview Abstract base class for validators. @see /demos/model/validators.html */ goog.provide('este.validators.Base'); goog.require('goog.asserts'); /** @param {function(): string=} getMsg @constructor */ este.validators.Base = function(getMsg) { if (getMsg) { this.getMsg = getMsg; } } /** Model to be validated. @type {este.Model} */ este.validators.Base.prototype.model = null; /** Model's property. @type {string} */ este.validators.Base.prototype.key = ''; /** Model's property value. @type {*} */ este.validators.Base.prototype.value = void 0; /** Returns true for truthy values except empty string. @return {boolean} */ este.validators.Base.prototype.isValidable = function() { return (this.value != null) && this.value !== ''; }; /** @return {boolean} True, if value is valid. */ este.validators.Base.prototype.validate = goog.abstractMethod; /** @return {string} */ este.validators.Base.prototype.getMsg = goog.abstractMethod;