UNPKG

json-api-schema

Version:

JSON Api Schema is a JSON dialect that can describe any Web Based API that uses JSON to exchange data.

28 lines (20 loc) 400 B
class ObjectIterator constructor: (@data) -> @index = 0 @keys = [] for k, v of @data @keys.push(k) @length = @keys.length next: -> return null unless @hasNext() element = @current() @index += 1 element hasNext: -> @index < @length rewind: -> @index = 0 @current() current: -> @data[@keys[@index]] module.exports = ObjectIterator