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

DH 4: ref+fix: simpler bool check, including 'undefined' #67

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

coolaj86
Copy link
Contributor

@coolaj86 coolaj86 commented Mar 14, 2024

Cleaner, easier to read and understand, also handles the case of undefined, rather than throwing an error.

Also corrects the type of getRawTransaction in a backwards-compatible way:

  • arg > 0 preserves the truthiness of values previously marked as int, providing an upgrade path

Should undefined throw?

If throwing an error for undefined is actually the desired behavior, this change can be made:

- return (String(arg).toLowerCase() === 'true' || arg > 0);
+ return (arg.toString().toLowerCase() === 'true' || arg > 0);

@coolaj86 coolaj86 changed the title ref+fix: simpler bool check, including 'undefined' DH 4: ref+fix: simpler bool check, including 'undefined' Apr 12, 2024
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

Successfully merging this pull request may close these issues.

None yet

1 participant