JavaScript port of Ally