aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/search.js6
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();