coffeescript and enum values

I know I'm late to the party, but for posterity I offer up a "coffeethonic" solution (in the spirit of less-typing):

[ a, b, c ] = [1..3]

The whole concept of enum is just useless in dynamic languages as is tuple, typed list, map and lots of other stuff, and Javascript (Coffeescript) is dynamic. While working with dynamic language you just have to forget about type checking and use the existing more general constructs to solve your problem. Use arrays instead of lists and tuples, use objects instead of maps and enums and just trust the type of value passed to the function, but heavily unit-test your code. For better or worse (for worse IMO) that's just how a work is done here.

In your case I would recommend just storing your values in a singleton object, like so:

HTTPStatusCodes = 
  ok : 200
  badRequest : 400
  unauthorized : 401

and accessing it like so:

class SomeService
  okCode: ->
    HTTPStatusCodes.ok
  failureCodes: ->
    code for key, code of HTTPStatusCodes when code >= 400