0

I am using Draft.js plugin Mention.

For editorState.content.entityMap.mention, I can successfully get value by

mention.get('address')

But why I check whether it is Map by

console.log('mention', mention);
console.log('mention instanceof Map', mention instanceof Map);

it returns false? Note the console shows mention is Map.

enter image description here

Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
  • I would imagine it's because there are two different `Map` classes, with either one or both a polyfill. – cartant Nov 19 '17 at 04:13

1 Answers1

1

When you write instanceof Map it refers to this native Map. I dug through the Draft.js source code (line 2) and found that they use a different kind of map from this library. So when you compare them it isn't the same.

Lilith
  • 437
  • 2
  • 11