Bug when one of breaks is exactly equal to zero

#3 · open · 2 comments

View on GitHub ↗

aparshin

[In this line](https://github.com/tannerjt/classybrew/blob/master/src/classybrew.js#L351) in the second condition you want to check that `i+1 < length`. But if one of breaks is exactly equal to zero, this check will fail (and `lalse` will be returned). Maybe, just check `i+1 < this.range.length`?

Comments

aparshin

I've add a comment to your commit - could you check it, please...

aparshin

Test case: ``` var brew = new classyBrew(); brew.setSeries([10, 15, 20]); brew.setNumClasses(3); brew.setColorCode('BuGn'); brew.classify('equal_interval'); console.log(brew.getColorInRange(9)); //returns false - that's right console.log(brew.getColorInRange(21)); //returns undefined - is this a bug? should return false too ```