question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Polyfill for Object.fromEntries doesn't work for arrays

See original GitHub issue

[Bug Report]

What

Polyfill for Object.fromEntries only works for maps, but not arrays in IE11.

Details

Example:

const arrayTest = [['foo', 'bar'], ['baz', 42]];

// Gets an error: [object, undefined] is not a function
const objectTest = Object.fromEntries(arrayTest);
// Works
const objectTest1 = Object.fromEntries(new Map(arrayTest));

Browser: IE11 OS: Windows 10 on virtualBox VM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
JakeChampioncommented, Mar 16, 2021

We support this case as well, which the test shows. @JiahuanWu, does your polyfill.io include Object.fromEntries in the features query parameter?

0reactions
JiahuanWucommented, Mar 27, 2021

@JakeChampion Sorry for late response. My data is just as simple as the test. And I tried on Parallels, it works fine. So I suppose it’s a problem of VirtualBox.
Thanks for your time. I’ll close the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object.fromEntries() - JavaScript - MDN Web Docs
An iterable, such as an Array or Map , containing a list of objects. Each object should have two properties: 0. A string...
Read more >
Add ES2019 Object.fromEntries function · Issue #30933 - GitHub
It looks to me that in tsconfig.json , the setting to use is target: "es2019" or greater. This means it won't work in...
Read more >
Unable to polyfill Object.fromEntries in Ember - Stack Overflow
fromEntries is not a function" and Safari 12 works fine on the page that uses it. When I use Safari dev tools I...
Read more >
The Object.fromEntries() method in vanilla JS - Go Make Things
fromEntries() method doesn't work on all iterables. The iterable must represent a key/value pair. That means it will work for FormData and Map() ......
Read more >
Introducing Object.fromEntries - DEV Community ‍ ‍
One of the great things about this function is that it works on all iterables. That means you can turn an Array into...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found