 Function::define = (name, methods) ->
   Object.defineProperty @::, name, methods
 
+Number::accountingFormat = ->
+  if @ < 0 then "($#{(@ * -1).toFixed(2)})" else "$#{@.toFixed(2)}"
+
 Number::bytesToString = ->
   return "#{@} B" if @ < 1000
 

String::dasherize = ->
  @replace /_/g, '-'

String::isBlank = ->
  @trim() is ''

String::phoneFormat = ->
  if /^1?\d{10}$/.test @


String::titleize = ->
  @replace(/_/g, ' ').replace /\b[a-z]/g, (char) -> char.toUpperCase()

String::underscore = ->
  @.replace(/[a-z][A-Z]/, (match) -> "#{match[0]}_#{match[1]}")
    .replace('::', '/')
    .toLowerCase()
