Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
CarolynWebster opened this issue May 11, 2021 · 4 comments
Assignees
Labels

Comments

@CarolynWebster
Copy link

CarolynWebster commented May 11, 2021

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)
    ....
@cerebralkungfu
Copy link
Contributor

Please confirm with today's release v2.1.0. I'll create a proof under examples/issues after a while if I don't hear back.

@CarolynWebster
Copy link
Author

I will test it out this week - thanks for the quick reply.

@cerebralkungfu cerebralkungfu self-assigned this May 12, 2021
cerebralkungfu pushed a commit that referenced this issue May 12, 2021
@cerebralkungfu
Copy link
Contributor

Fixed in v2.1.1

@CarolynWebster
Copy link
Author

The issue is resolved in 2.1.1. I am going to go with 2.2.0 since it fixes the extra console log that was in the util file. Thanks for taking care of this quickly! Excited to upgrade and get the typescript support. Appreciate you and your work on this library! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants