JS port of EulerPy