Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
handle edge case in getClosestIndexArr
Browse files Browse the repository at this point in the history
  • Loading branch information
letmaik committed Mar 30, 2016
1 parent 5b46ee3 commit a228c9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ function getClosestIndex (domain, axis, val) {
function getClosestIndexArr (vals, val) {
let [lo,hi] = arrays.indicesOfNearest(vals, val)
let idx = Math.abs(val - vals[lo]) <= Math.abs(val - vals[hi]) ? lo : hi
return {idx, outside: lo === hi}
return {idx, outside: lo === hi && vals[lo] !== val}
}

function prepareForAxisArraySearch (domain, axis, ...searchVal) {
Expand Down

0 comments on commit a228c9b

Please sign in to comment.