aurelia/polyfills

Object.entries polyfill

zewa666 opened this issue · 2 comments

With ES2017 there is Object.entries which is not yet covered by aurelia polyfills.
It would be great if we could add that as well.

I'm just not certain where to add this, since there are no ES2017 polyfills prepared yet if I'm not wrong.

Polyfill:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries#Polyfill

if (!Object.entries)
  Object.entries = function( obj ){
    var ownProps = Object.keys( obj ),
        i = ownProps.length,
        resArray = new Array(i); // preallocate the Array
    while (i--)
      resArray[i] = [ownProps[i], obj[ownProps[i]]];
    
    return resArray;
  };

Closed due to discussion in linked PR