diff options
| author | Holden Rohrer <holden.rohrer@gmail.com> | 2019-12-20 17:59:04 -0500 | 
|---|---|---|
| committer | Holden Rohrer <holden.rohrer@gmail.com> | 2019-12-20 17:59:04 -0500 | 
| commit | 3348e132714efc2b896eccc4749695ac069f0f0c (patch) | |
| tree | a6df51c773ed94d4f84f537934a9d41a71a4b8e1 | |
| parent | f11efe3b4a4c6d44f3e686fb9e4ee86b11000f3f (diff) | |
added .has to search
| -rw-r--r-- | examples/search.js | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/examples/search.js b/examples/search.js index 9465e08..92d8d65 100644 --- a/examples/search.js +++ b/examples/search.js @@ -73,6 +73,12 @@ function Search(searchBlock){ // searchBlock should be a Space object.        this.sort[ind].splice(bs(this.sort[ind], loc, getComp(ind)), 1);      })    } + +  this.has = function(loc){ +    if (bs(this.sort[0], loc, getComp(0)) < 0) return false; // Could use ind = 1 just as well, but doesn't really matter +    // bs returns negative if not found. +    else return true; +  }  }  let space = new Space(); | 
