Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Assert if a string is a valid finite numeric value #1015

Unanswered
romanstetsyk asked this question in stdlib-bot Q&A
Discussion options

Is there a package to check if a string is a valid finite numeric value?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

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.
You must be logged in to vote
1 reply
Comment options

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /