_Length.js 843 B

123456789101112131415161718192021222324
  1. // Generated by CoffeeScript 1.9.3
  2. var _Declaration, _Length,
  3. 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.__super__ = parent.prototype; return child; },
  4. hasProp = {}.hasOwnProperty;
  5. _Declaration = require('./_Declaration');
  6. module.exports = _Length = (function(superClass) {
  7. extend(_Length, superClass);
  8. function _Length() {
  9. return _Length.__super__.constructor.apply(this, arguments);
  10. }
  11. _Length.prototype._set = function(val) {
  12. if (!/^[0-9]+$/.test(String(val))) {
  13. throw Error("`" + this.prop + "` only takes an integer for value");
  14. }
  15. return this.val = parseInt(val);
  16. };
  17. return _Length;
  18. })(_Declaration);