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

fix(isNumber): parse string parameter as number (allow string as parameter) #444

Merged
merged 2 commits into from
Sep 2, 2022

Conversation

sawa-ko
Copy link
Contributor

@sawa-ko sawa-ko commented Sep 2, 2022

This PR is due to the fact that this utility cannot accept a string as a value, so what has to be done is:

const numberString = '1';
isNumber(Number(numberString));

With this PR you will now be able to do the following:

const numberString = '1';
isNumber(numberString);

This helps for example, if you have an API and you receive a query parameter, this will come in string type, with this you can validate directly without the need to convert it to a number manually.

@favna favna changed the title feat(utilities/isNumber): parse string parameter as number (allow string as parameter) feat(isNumber): parse string parameter as number (allow string as parameter) Sep 2, 2022
@favna favna changed the title feat(isNumber): parse string parameter as number (allow string as parameter) fix(isNumber): parse string parameter as number (allow string as parameter) Sep 2, 2022
@favna favna merged commit 01e1b14 into sapphiredev:main Sep 2, 2022
@sawa-ko sawa-ko deleted the x branch September 2, 2022 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants