#1062 | 2022-08-11 16:29:59

把英文单词转为复数形式的包

原理是先把那些不规则的变形单词挑出来,然后对剩下的应用这些规则:

  • Words ending in s, x, z, ch, sh will be pluralized with -es (eg. foxes).
  • Words ending in y that are preceded by a consonant will be pluralized by replacing y with -ies (eg. puppies).
  • All other words will have "s" added to the end (eg. days).

缺点是没法对本身就是复数形式的单词进行兼容。。

console.log(plur('tests')) // testses