Javascript meteor for(let x of y)未由ecmascript翻译
我有一个应用程序在某些设备/浏览器上产生错误(例如在Android默认浏览器上) 经过一段时间的调试,我注意到一些ES6代码似乎滑到了生成的JS中:Javascript meteor for(let x of y)未由ecmascript翻译,javascript,android,meteor,ecmascript-6,Javascript,Android,Meteor,Ecmascript 6,我有一个应用程序在某些设备/浏览器上产生错误(例如在Android默认浏览器上) 经过一段时间的调试,我注意到一些ES6代码似乎滑到了生成的JS中: Template.updateAccountModalInner.helpers({ notAllEmailsVerified: function () { const user = Session.get('userInScope'); if (!user || !user.emails) { return n
Template.updateAccountModalInner.helpers({
notAllEmailsVerified: function () {
const user = Session.get('userInScope');
if (!user || !user.emails) {
return null;
}
for(let email of user.emails) {
if (!email.verified) {
return true;
}
}
return false;
},
尽管我使用ecmascript包(ecmascript@0.7.3,ecmascript-runtime@0.3.15)“for(让email of user.emails)”保留在生成的文件中
在package.json中,我有:
"dependencies": {
"babel-runtime": "^6.23.0",
"bcrypt": "^1.0.2"
}
这个语法正确吗?我需要为JS文件启用ES&for吗
IDEA建议我将a for(var x of y)转换为for(let x of y)…您是否安装了
ecmascript
软件包?什么是user.emails
?是数组还是对象?是,ecmascript@0.7.3已安装。user.emails是一个数组。呃,我不知道你为什么在Android上会出现问题。我鼓励你尝试some
。用return user.emails.some替换你的循环(email=>!email.verified)
和delete返回false
。啊,谢谢,不管怎样读起来还是不错的。我会试试这个。