JavaScript port for node and browser