javascript implementation of univaruints