Skip to content

.has(/* nothing */) should be true #63

@fiatjaf

Description

@fiatjaf

code on

object-path/index.js

Lines 160 to 162 in c540af3

if (isEmpty(path) || path.length === 0) {
return false;
}
for the .has() method:

    if (isEmpty(path) || path.length === 0) {
      return false;
    }

If we are searching for an empty key and the variable being searched is an object, then it is intuitive that the object has that. It can perhaps miss all keys in the world as long as long as they have a name, but for keys with no name any object has all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions