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

Suggestion to add a pluralize variant for quantity-label pairs #44

Closed
ppKrauss opened this issue Mar 8, 2018 · 1 comment
Closed

Suggestion to add a pluralize variant for quantity-label pairs #44

ppKrauss opened this issue Mar 8, 2018 · 1 comment

Comments

@ppKrauss
Copy link

ppKrauss commented Mar 8, 2018

As in a quantity-unit string, eg. "discance of 10 km", the string "need 10 items" is a value-label pair, and it is very commom... Need only a simple return value + ' ' + pluralize(value), or

function pluralize_qt (value) {
  var args = util.toArray(arguments, 1)
  var label = args.length > 1
    ? (args[value % 10 - 1] || args[args.length - 1])
    : (args[0] + (value === 1 ? '' : 's'));
  return value + ' '+ label;
}
@freearhey
Copy link
Owner

Done.

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

No branches or pull requests

2 participants