UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

48 lines (43 loc) 1.39 kB
// Generated by github.com/steida/coffee2closure 900.1.18 /** @fileoverview Digits validator. */ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.superClass_ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; goog.provide('este.validators.Digits'); goog.provide('este.validators.digits'); goog.require('este.validators.Base'); /** @param {function(): string=} getMsg @constructor @extends {este.validators.Base} */ este.validators.Digits = function(getMsg) { este.validators.Digits.superClass_.constructor.call(this, getMsg); } extend(este.validators.Digits, superClass); /** @override */ este.validators.Digits.prototype.validate = function() { goog.asserts.assertString(this.value); return /^\d+$/.test(this.value); }; /** @override */ este.validators.Digits.prototype.getMsg = function() { /** @desc Digits validator message. */ return este.validators.Digits.MSG_VALIDATOR_DIGITS = goog.getMsg('Please enter only digits.'); }; /** @param {function(): string=} getMsg @return {function(): este.validators.Digits} */ este.validators.digits = function(getMsg) { return function() { return new este.validators.Digits(getMsg); }; };