dashd-rpc
dashd-rpc copied to clipboard
DH 4: ref+fix: simpler bool check, including 'undefined'
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 asint
, 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);