Skip to content

Commit

Permalink
put constructor at the top
Browse files Browse the repository at this point in the history
  • Loading branch information
shanzi committed Apr 23, 2015
1 parent d17d534 commit b1014cb
Showing 1 changed file with 12 additions and 14 deletions.
Expand Up @@ -14,6 +14,18 @@ class InspectData extends Directive

class _InspectData extends Controller

constructor: ->
return if not @data

@items = []

if @data instanceof Array
for item in @data
@addItem item[0], item[1]
else
for k, v of @data
@addItem(k, v)

processValue: (value) ->
if typeof(value) == 'string'
type = 'string'
Expand All @@ -37,17 +49,3 @@ class _InspectData extends Controller
@items.push
key: k
value: @processValue(v)

constructor: ->
return if not @data

@items = []

if @data instanceof Array
for item in @data
@addItem item[0], item[1]
else
for k, v of @data
@addItem(k, v)


0 comments on commit b1014cb

Please sign in to comment.