Skip to content

select1() will return undefined when it can't find anything #140

@YbJerry

Description

@YbJerry

When select1() can't find anything, it will return undefined. But at first, I think it should return null as I don't find undefined in type SelectSingleReturnType

In line 5000 of path.js

result = result.nodes;
if (single) {
    result = result[0];
}

In this situation, nodes will be an empty array. So result[0] will be undefined.

So I suggest that there should be a comment for users to know it will return undefined. Thanks.

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