JavaScript translation of the Rant engine