Skip to content

get blows up when trying to extract path from a null value - failed gracefully in 1.2.0 #36

Closed
@CarolynWebster

Description

@CarolynWebster

I recently upgraded to 1.3.1 so I could use this library with Typescript, but it seems like what used to fail gracefully is now blowing up.

If I have an object like:

{
    id: 1234,
    employee: null,
    created_on: 2021-05-11
}

With 1.2.0 - if I tried to get the field "/employee/st_price" - it would fail gracefully and return undefined
With 1.3.1 - it blows up saying it can't find "st_price" in null

Uncaught TypeError: Cannot read property 'st_price' of null
    at JsonPointer.eval (eval at compilePointerDereference (util.js?06b3:1), <anonymous>:5:17)
    at JsonPointer.get (pointer.js?05e6:131)
    at Function.get (pointer.js?05e6:81)
    ....

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions