Skip to content

Object.entries not supported in IE #9957

@ylligashi

Description

@ylligashi

Object.entries should be included in the polyfills for IE support

Versions

Angular CLI: 1.5.0
Node: 8.9.1
OS: darwin x64
Angular: 5.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.21
@angular-devkit/schematics: 0.0.37
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.7
typescript: 2.4.2
webpack: 3.8.1

Repro steps

If you ever want to use Object.entries you can not

Observed behavior

Object.entries is not supported in IE

Desired behavior

Object.entries should be supported and added to polyfills

Mention any other details that might be useful (optional)

This is the code to be added:

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;
  };

Source: https://stackoverflow.com/questions/42446062/object-doesnt-support-property-or-method-entries

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureLabel used to distinguish feature request from other issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions