我有一个流星方法调用,该流星方法在ES6代码下具有此代码,由于以下指出的错误而无法进行翻译。
theOthers.forEach(member => {
if (member.notifications) {
const contextIdIndex = member.notifications.findIndex(
notification => notification.contextId === contextId
);
if (contextIdIndex !== -1) {
const notifications = [...member.notifications];
notifications[contextIdIndex].count += 1;
Meteor.users.updateOne(member.memberId, {
$set: {
notifications: notifications
}
});
}
}
});
转码失败错误是:
This API has been removed. If you're looking for this functionality in Babel 7, you should import the '@babel/helper-module-imports' module and use the functions exposed from that module, such as 'addNamed' or 'addDefault'.
有什么建议吗?请注意,我有一堆可以正常工作的类似ES6代码。