Some utils implemented by pure javascript.