-
-
Notifications
You must be signed in to change notification settings - Fork 879
Assert if a string is a valid finite numeric value #1015
Unanswered
romanstetsyk
asked this question in
stdlib-bot Q&A
-
Is there a package to check if a string is a valid finite numeric value?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Unknown.
Disclaimer
- This answer was generated with the help of AI and is not guaranteed to be correct. We will review the answer and update it if necessary.
- You can also ask follow-up questions to clarify the answer or request additional information by leaving a comment on this issue starting with
/ask
.
Beta Was this translation helpful? Give feedback.
All reactions
1 reply
-
@romanstetsyk If you are just wanting to know that a value is finite, you can do something like
const isFinite = require( '@stdlib/assert-is-finite' ).isPrimitive; // ... const bool = isFinite( parseFloat( value ) ); // returns <boolean>
If you are wanting to know if a value is within a certain range, you can do something like
const isBetween = require( '@stdlib/assert-is-between' ); // ... const high = 100; const low = 10; const bool = isBetween( parseFloat( value ), low, high ); // returns <boolean>
Links
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment