我有一个js函数
export const cleanUp = async () => {
await User.destroy({ where: {} });
};我正在尝试使用以下命令在await User.destroy({ where: {} })下面插入一行
recast.parse(`await ${module}.destroy({ where: {} });`);但我一直保持着。获取Unexpected Identifier,因为esprima需要异步声明。我还能怎么做到这一点?
发布于 2019-04-10 02:26:53
esprima声称“完全支持ECMAScript 2016 (ECMA-262第7版)”,而“等待”的初始定义在"ECMAScript 2017 (ECMA-262)“中。
我认为这可能是问题所在。
http://esprima.org/ (特征段落)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#Specifications
https://stackoverflow.com/questions/55592734
复制相似问题