-### 
+###
 Standalone Deferred
-Copyright 2012 Otto Vehviläinen 
+Copyright 2012 Otto Vehviläinen
 Released under MIT license
 
-This is a standalone implementation of the wonderful jQuery.Deferred API. 
+This is a standalone implementation of the wonderful jQuery.Deferred API.
 The documentation here is only for quick reference, for complete api please
 see the great work of the original project:
 

              def.rejectWith.call(def, this, failArgs...)
        else
          def.rejectWith.call(def, this, result)
        def.rejectWith.call(def, this, args...) 
      else
        def.rejectWith.call(def, this, args...) 
    def.promise()

  ###

flatten = (args) ->
  return [] unless args
  flatted = []
  args.forEach (item) ->
    if item
      if typeof item == 'function'
        flatted.push(item)
      else
        args.forEach (fn) ->
          if typeof fn == 'function'
            flatted.push(fn)
  flatted


###
Promise object functions as a proxy for a Deferred, except
it does not let you modify the state of the Deferred
###
class Promise
