-
Notifications
You must be signed in to change notification settings - Fork 701
Pluralize function at correcting #187
Copy link
Copy link
Closed
Description
Hello,
I just detect a minor bug in your script for the "pluralize".
Numéric> 1 = Plurialize string OK
Numéric = 1 = singularize string OK
Numéric = 0 = Singlularize string KO
I thank in advance the creator of this script to modify its code.
Update if (Math.abs(count) === 1) by if (Math.abs(count) === 1 || Math.abs(count) === 0)
function pluralize(format, count) {
var plural = "s", singular = "";
if (format) {
format = format.replace(/(:|;|\s)/gi, "").split(/\,/);
if (format.length === 1) {
plural = format[0];
} else {
singular = format[0];
plural = format[1];
}
}
if (Math.abs(count) === 1 || Math.abs(count) === 0 ) {
return singular;
} else {
return plural;
}
}
Reactions are currently unavailable