![](/img/trans.png)
[英]How do I delay an array callback using async/await in JavaScript?
[英]How do i create an await expression using recast/esprima
我有一個js功能
export const cleanUp = async () => {
await User.destroy({ where: {} });
};
我試圖在await User.destroy({ where: {} })
下面插入一行
recast.parse(`await ${module}.destroy({ where: {} });`);
但我保持。 得到Unexpected Identifier
因為esprima期望異步聲明。 我怎么能做到這一點?
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.