Navigation Menu

Skip to content

Commit

Permalink
number_array subrule: filter out zeroes from the list
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrec committed Oct 19, 2012
1 parent 33f0028 commit 4faa4b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/subrules/number_array.js
Expand Up @@ -4,8 +4,9 @@ function number_arraySubRule (list) {
this.length = 1
this.next = lastSubRule
// Specific properties
this.list = list
this.hasZero = list.some(function (v) { return v === 0 })
// Filter out zero values
this.list = list.filter(function (v) { return v !== 0 })
this.hasZero = (list.length > this.list.length)
}

number_arraySubRule.prototype.test = function (buf, offset) {
Expand Down

0 comments on commit 4faa4b9

Please sign in to comment.