JavaScript Implementation of SuffixTree Algorithm