1

I have a meteor method call that has this below ES6 code which fails to transpile due to the error noted below.

  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
          }
        });
      }
    }
  });

The transpiling failure error is:

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'.

Any suggestions? Note that I have bunch of similar ES6 code that works just fine.

Emo
  • 580
  • 1
  • 8
  • 27
  • 1
    Which line of code is causing that? Have you tried doing as it suggests? – Mikkel Dec 27 '18 at 20:35
  • I think it's this one: `const contextIdIndex = member.notifications.findIndex( notification => notification.contextId === contextId );` Not sure how I would really proceed indeed... – Emo Dec 28 '18 at 22:51

0 Answers0