rewrite with esprima