Skip to content

Array diff includes extensions to the Array prototype  #117

@AlexMedia

Description

@AlexMedia

I have a project where a few functions have been added to Array.prototype. When I have two objects that I want to run a diff against, jsondiffpatch returns me the array with a couple of NaN keys added to the bottom, without any values. The amount of NaNs is equal to the amount of functions which were added to the prototype.

I made a sample JSFiddle which can be viewed here.

I would suggest that these items do not show up in the diff, as these functions are not part of the array but instead of its prototype. I believe that using array.hasOwnProperty(key) could be used to exclude prototype extensions, but I'm still trying to figure out how array diffing works internally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions