Feature: Support cloning of es6 Maps
Closed this issue · 2 comments
omerts commented
Currently when trying to clone an ES2015 Map object, I get an empty object returned.
pvorb commented
What platform are you using? Which browser/Node.js version? Browserify, Webpack, etc.?
tristanls commented
I'm not sure if this is the correct place to put this, but lack of support for Maps breaks clone in newest Node.js.
$ node -v
v6.5.0
$ node
> const clone = require("clone");
undefined
> const map = new Map();
undefined
> map.set("key", "value");
Map { 'key' => 'value' }
> map.has("key");
true
> const clonedMap = clone(map)
undefined
> clonedMap.has("key");
TypeError: Method Map.prototype.has called on incompatible receiver #<Map>
at Map.has (native)
at repl:1:11
at sigintHandlersWrap (vm.js:22:35)
at sigintHandlersWrap (vm.js:96:12)
at ContextifyScript.Script.runInThisContext (vm.js:21:12)
at REPLServer.defaultEval (repl.js:313:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:504:10)
at emitOne (events.js:101:20)