Skip to content

Commit

Permalink
Don't pluralize nouns ending in o.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Mar 5, 2024
1 parent d9098e1 commit 5ed084c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,10 @@ function pluralize(s) {
&& len > 1
&& ((ch = s.charCodeAt(len - 2)) === 115 /*s*/ || ch === 99 /*c*/)) {
return s + "es";
} else if ((last === 121 /*y*/ || last === 111 /*o*/)
} else if (last === 121 /*y*/
&& len > 1
&& /^[bcdfgjklmnpqrstvxz]/.test(s.charAt(len - 2))) {
return last === 121 ? s.substring(0, len - 1) + "ies" : s + "es";
return s.substring(0, len - 1) + "ies";
} else if (last === 116 /*t*/) {
if (s === "that") {
return "those";
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,10 @@ function pluralize($s) {
&& $len > 1
&& ($s[$len - 2] === "s" || $s[$len - 2] === "c")) {
return "{$s}es";
} else if (($last === "y" || $last === "o")
} else if ($last === "y"
&& $len > 1
&& strpos("bcdfgjklmnpqrstvxz", $s[$len - 2]) !== false) {
return $last === "y" ? substr($s, 0, $len - 1) . "ies" : $s . "es";
return substr($s, 0, $len - 1) . "ies";
} else if ($last === "t") {
if ($s === "that") {
return "those";
Expand Down

0 comments on commit 5ed084c

Please sign in to comment.