Skip to content

Instantly share code, notes, and snippets.

@101arrowz
Last active September 24, 2020 17:08
Show Gist options
  • Save 101arrowz/07ce01f111dcde6ba6b0077817400f95 to your computer and use it in GitHub Desktop.
Save 101arrowz/07ce01f111dcde6ba6b0077817400f95 to your computer and use it in GitHub Desktop.
Tiny Object.fromEntries Polyfill
Object.fromEntries = function(entries) {
return entries.reduce(
function(a, v) { a[v[0]] = v[1]; return a; },
{}
);
};
// ES6
Object.fromEntries = entries => entries.reduce((a, v) => (a[v[0]] = v[1], a), {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment