Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

feat: export pluralize functionality #159

Merged
merged 3 commits into from
Feb 6, 2020
Merged

feat: export pluralize functionality #159

merged 3 commits into from
Feb 6, 2020

Conversation

imurchie
Copy link
Contributor

@imurchie imurchie commented Feb 6, 2020

Add export of https://github.com/blakeembrey/pluralize through the util module.

lib/util.js Outdated
*
* @param {string} word - The word to pluralize
* @param {number} count - How many of the word exist
* @param {?boolean} inclusive - Whether to prefix with the number (e.g., 3 ducks)
Copy link
Contributor

Choose a reason for hiding this comment

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

inclusive [false]
I'd also think about putting all options into a dictionary, so we could extend it later if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

lib/util.js Outdated
* @param {PluralizeOptions} options - options for word pluralization
* @returns {string} The word pluralized according to the number
*/
function pluralize (options = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

the word and the count may stay as ordinary args, since they are always required

inclusive = false,
} = options;
function pluralize (word, count, options = {}) {
let inclusive = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@imurchie imurchie merged commit 2811b52 into master Feb 6, 2020
@imurchie imurchie deleted the isaac-pluralize branch February 6, 2020 18:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants