javascript algorithms for nodejs