Skip to content

Comparing objects with empty prototypes (no hasOwnProperty method) #7

Closed
@denisnd

Description

@denisnd

I'm using deep-object-diff to compare objects generated by query-string. Structures returned by its parser have no hasOwnProperty method (sindresorhus/query-string#47) and so deep-object-diff can't work on them as it relies on the method.

Steps to reproduce:

var deepObjectDiff = require('deep-object-diff');

var a = Object.create(null);
a.foo = 'bar;

var b = Object.create(null);
b.foo = 'baz';

console.log( deepObjectDiff.diff(a, b) );

Error message:

TypeError: rhs.hasOwnProperty is not a function
    at C:\Users\nd\object-diff\node_modules\deep-object-diff\dist\diff\index.js:55:18

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