Sha256: 3629106a6a278048115f3d6d10307e319de8f3df190557d6b223c87b1abd4faf
Contents?: true
Size: 701 Bytes
Versions: 60
Compression:
Stored size: 701 Bytes
Contents
# TODO locales support class @Phone constructor: (@area_code, @number) -> {@area_code, @number} = @area_code if typeof @area_code == 'object' # TODO parse argument types to validate value object domain # constraints unless @number @number = @area_code @area_code = null Object.defineProperty @, 'valid', get: @validate # TODO move type validation to indemma files validate: -> @area_code? && @number? toString: -> formatted_number = @number.substr(0, 4) + '-' + @number.substr(4) if @number? if @area_code? "(#{@area_code}) #{formatted_number}" else formatted_number toJSON: -> area_code: @area_code number: @number
Version data entries
60 entries across 60 versions & 1 rubygems