Skip to content

Commit

Permalink
Merge pull request #476 from goto-bus-stop/no-global
Browse files Browse the repository at this point in the history
Don't polyfill Object.entries globally
  • Loading branch information
jamuhl committed Jul 16, 2018
2 parents 02bffe8 + f9e1f9d commit 5ad9cbd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/loadNamespaces.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// shim object entries
if (!Object.entries)
Object.entries = function( obj ){
const objectEntries = Object.entries ||
function( obj ){
var ownProps = Object.keys( obj ),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
Expand All @@ -14,7 +13,7 @@ if (!Object.entries)
function eachComponents(components, iterator) {
for (let i = 0, l = components.length; i < l; i++) { // eslint-disable-line id-length
if (typeof components[i] === 'object') {
for (const [key, value] of Object.entries(components[i])) {
for (const [key, value] of objectEntries(components[i])) {
iterator(value, i, key);
}
} else {
Expand Down

0 comments on commit 5ad9cbd

Please sign in to comment.