Show More
Commit Description:
fix wrong merge
Commit Description:
fix wrong merge
References:
File last commit:
Show/Diff file:
Action:
node_modules/restructure/src/Enum.coffee | 17 lines | 363 B | text/coffeescript | CoffeeScriptLexer |
class Enum
constructor: (@type, @options = []) ->
decode: (stream) ->
index = @type.decode(stream)
return @options[index] or index
size: ->
@type.size()
encode: (stream, val) ->
index = @options.indexOf val
if index is -1
throw new Error "Unknown option in enum: #{val}"
@type.encode(stream, index)
module.exports = Enum