Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use keyword in instead of hasOwnProperty to check if property exists #174

Copy link
Copy link
@ksimple

Description

@ksimple
Issue body actions

Describe the bug

hasOwnProperty does not behave as the same as keyword in, it doesn't check the inheritance of property and doesn't check if propety whichi is in prototype

Code sample or steps to reproduce

function target() {
    this.key1 = 1;
}

target.prototype.key2 = 2;

let obj = new target();

console.log(JSONPath({ path: '$.key1', json: obj }));
console.log(JSONPath({ path: '$.key2', json: obj }));

Console error or logs

[ 1 ]
[]

Expected behavior

[ 1 ]
[ 2 ]

Expected result

Environment (IMPORTANT)

  • JSONPath-Plus version: [e.g. 4.0.0]
    7.0.0

Desktop**

  • OS: [e.g. Windows]
  • Browser and version [e.g. chrome 65] or Node Version [e.g. 10.2]

Additional context

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.