IPNS publish and resolve programmatically in node-js

The docs of Name API have some example code on how to resolve a cid from IPNS. I got the publish example code working fine but the resolve example code gives an error in the console: is not iterable.

// The IPNS address you want to resolve.
const addr = '/ipns/ipfs.io'

for await (const name of ipfs.name.resolve(addr)) {
  // /ipfs/QmQrX8hka2BtNHa8N8arAq16TCVx5qHcb46c5yPewRycLm

I inserted it in the browser-mfs example, at the bottom just after “updateTree(ipfs)”

Any tips or suggestions? :see_no_evil: :hear_no_evil: :speak_no_evil: