Skip to content

Commit

Permalink
Minor code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobrask committed Sep 21, 2011
1 parent 7843d64 commit 1b3e5f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lib/app.coffee
Expand Up @@ -117,10 +117,7 @@
# checkbox toggles "state"
# 1 is open, 0 is done
obj['type'] = 'state'
if $(el).prop('checked')
obj['value'] = 0
else
obj['value'] = 1
obj['value'] = if $(el).prop('checked') then 0 else 1
return obj

# generate a list item and add events
Expand Down Expand Up @@ -175,7 +172,8 @@
$checkedLis = $('.list li.checked')
$uncheckedLis = $('.list li:not(.checked)')
# if list is empty, or if item is the first checked item, append
if $('.list li').length is 0 or (item.state is '0' and $checkedLis.length is 0)
if $('.list li').length is 0 or
(item.state is '0' and $checkedLis.length is 0)
$liEl.appendTo($list)
# if item is checked,
# add after last checked item
Expand Down
4 changes: 2 additions & 2 deletions lib/db.coffee
Expand Up @@ -39,7 +39,7 @@
# update an arbitrary field in database, check for data type
db.set = (key, data, callback) ->
rdb.type key, (err, type) ->
if (typeof data is 'string' or typeof data is 'number' or typeof data is 'boolean')
if typeof data in ['string', 'number', 'boolean']
# String
# for new fields, assume string type
switch type
Expand Down Expand Up @@ -70,7 +70,7 @@
callback err if err

# Hashes
else if data? and typeof data is 'object' and (type is 'hash' or type is 'none')
else if data? and typeof data is 'object' and (type in ['hash', 'none'])
rdb.hmset key, data, (err) ->
callback err
else
Expand Down

0 comments on commit 1b3e5f9

Please sign in to comment.