function _pointSearch()

in src/lib/intervalTree.js [159:183]


function _pointSearch(node, idx, arr) {
  if (!node) return;

  if (idx < node.idx) {
    node.starts.every(function(itvl) {
      var bool = (itvl.start <= idx);
      if (bool) arr.push(itvl.result());
      return bool;
    });
    return _pointSearch.call(this, node.left, idx, arr);
  }

  else if (idx > node.idx) {
    node.ends.every(function(itvl) {
      var bool = (itvl.end >= idx);
      if (bool) arr.push(itvl.result());
      return bool;
    });
    return _pointSearch.call(this, node.right, idx, arr);
  }
  // exact equal
  else {
    node.starts.map(function(itvl) { arr.push(itvl.result()); });
  }
}