Skip to content

Commit

Permalink
changed batch to return [] when count is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
farzher committed Aug 3, 2014
1 parent eeb5c0f commit d441b4f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion browser.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.ls
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ _.where = (query, list) ->
, list

_.batch = (count, list) ->
count = Number count; if count < 1 => count = 1
list = _.clone list
count = Number count; if count < 1 => return []
list = list.slice 0
return (while list.length => list.splice 0, count)


Expand Down
2 changes: 1 addition & 1 deletion test/test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/test.ls
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ exports import
it.strictEqual (_.batch 2, list).length, list.length / 2
it.strictEqual (_.batch 1, list).length, list.length
it.strictEqual (_.batch list.length, list).length, 1
it.strictEqual (_.batch '-1', list).length, list.length, 'Batching by a broken amount should default to batching by 1'
it.strictEqual (_.batch '-1', list).length, 0, 'Batching by a broken amount should return []'
it.done!

0 comments on commit d441b4f

Please sign in to comment.