I have a js function
export const cleanUp = async () => {
await User.destroy({ where: {} });
};
I am trying to insert a line below await User.destroy({ where: {} }) using
recast.parse(`await ${module}.destroy({ where: {} });`);
But I keep. getting Unexpected Identifier because esprima expects an async declaration. How else can I achieve this?
esprima claims "Full support for ECMAScript 2016 (ECMA-262 7th Edition)" while "await" initial definition was in "ECMAScript 2017 (ECMA-262)"
I think this can be the problem.
http://esprima.org/ (Features paragraph)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#Specifications