Closed zloirock closed 8 years ago
Thanks for the report!
It looks like the implementation of this is actually correct, because it's using object-keys
and not Object.keys
or for..in
. A simpler test case that avoids Object.keys
is test.js having:
require('object.assign').shim();
var t = {};
'abcdefghijklmnopqrst'.split('').forEach(_ => t[_] = _);
var str = '';
var obj = Object.assign({}, t);
for (var k in obj) {
str += k;
}
console.log(str);
However, despite the implementation being correct, the shim isn't currently detecting this case. I'll get a fix up for this shortly.
Also, interesting to note that 'abcdefghijklmnopqrst'
triggers the bug, but 'abcdefghijklmnopqrs'
does not!
Released as v4.0.2.
Node 4.2.1:
Why? It's a bug of V8 implementation - the same
Object.getOwnPropertyNames
enumeration order. Required runtime test, but you don't do it. You test only implementation, not result ofrequire('object.assign').shim()
. Related https://github.com/kangax/compat-table/commit/afa89886cdf8a954f5572b3c96f50122582c9a08