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: Modified inflect() method to allow floats #86

Merged
merged 1 commit into from
Nov 20, 2021

Conversation

bijx
Copy link
Contributor

@bijx bijx commented Nov 19, 2021

If you give the inflect() function a float number such as 1.5 (or really any number between 1 < n <= 2) the string should be pluralized. Due to the parseInt(), however, the string is left singular. This fix aims to solve that issue by allowing floats and evaluating the only case where singular is used: count=1;.

Example:
inflect( 'inches', 1) // 'inch'
inflect( 'inches', 1.5) // 'inches'

…s between 1 < n <= 2 are not accidentally left singularized.
Copy link
Collaborator

@p-kuen p-kuen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@bijx
Copy link
Contributor Author

bijx commented Nov 22, 2021

@p-kuen Glad to contribute! Just curious, when do you think the NPM package will update?

@p-kuen
Copy link
Collaborator

p-kuen commented Jan 29, 2022

Sorry it took so long. I just published 1.13.2 to fix this issue.

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.

2 participants