Javascript implementation of the pymag-tree algorithms