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

Missing data issue #129 and MaybeNumber #135

Closed
owattenmaker opened this issue Oct 3, 2023 · 3 comments
Closed

Missing data issue #129 and MaybeNumber #135

owattenmaker opened this issue Oct 3, 2023 · 3 comments

Comments

@owattenmaker
Copy link
Contributor

Since the recent update (40.0.0) I've noticed that #129 works for undefined values, but for data that is null the output will still populate as a value of 0.

This is due to the asNumber function. I know #129 removed some of the calls to this, but it didn't fix the root cause of the issue being the following:

asNumber(null)
>>> 0
asNumber(undefined)
>>> NaN

One fix for this is to update the asNumber function like so:

export const asNumber = (val: unknown): number => {
  "worklet";
  if (val === null) return NaN
  return typeof val === "number" ? val : Number(val);
};
@gksander
Copy link
Contributor

gksander commented Oct 3, 2023

Thanks for reporting this in – I'll take a look!

@gksander
Copy link
Contributor

gksander commented Oct 3, 2023

#138 was merged, release as 40.0.2, and I think that should resolve the issue you're seeing around null values. If not, let's reopen this!

@gksander gksander closed this as completed Oct 3, 2023
@owattenmaker
Copy link
Contributor Author

Thank you!

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

No branches or pull requests

2 participants