From 3348e132714efc2b896eccc4749695ac069f0f0c Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Fri, 20 Dec 2019 17:59:04 -0500 Subject: added .has to search --- examples/search.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'examples/search.js') 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(); -- cgit