Sha256: fea9aa0a2ab1f1e9df139d2c9f2eecdb670d2a744c42958d64ac3c9fee296038
Contents?: true
Size: 1.03 KB
Versions: 60
Compression:
Stored size: 1.03 KB
Contents
this.Phone = (function() { function Phone(area_code, number) { var _ref; this.area_code = area_code; this.number = number; if (typeof this.area_code === 'object') { _ref = this.area_code, this.area_code = _ref.area_code, this.number = _ref.number; } if (!this.number) { this.number = this.area_code; this.area_code = null; } Object.defineProperty(this, 'valid', { get: this.validate }); } Phone.prototype.validate = function() { return (this.area_code != null) && (this.number != null); }; Phone.prototype.toString = function() { var formatted_number; if (this.number != null) { formatted_number = this.number.substr(0, 4) + '-' + this.number.substr(4); } if (this.area_code != null) { return "(" + this.area_code + ") " + formatted_number; } else { return formatted_number; } }; Phone.prototype.toJSON = function() { return { area_code: this.area_code, number: this.number }; }; return Phone; })();
Version data entries
60 entries across 60 versions & 1 rubygems