]> git.r.bdr.sh - rbdr/generador-de-insultos/commitdiff
Don't pluralize words that end with s
authorBen Beltran <redacted>
Sun, 6 Sep 2015 01:24:11 +0000 (20:24 -0500)
committerBen Beltran <redacted>
Sun, 6 Sep 2015 01:24:11 +0000 (20:24 -0500)
lib/InsultGenerator.js

index 7951204f503bf42d0cbea73420020411dee49802..5c40651a7493921e5dd5c118102d39b8d8ae4903 100644 (file)
@@ -160,8 +160,15 @@ var InsultGenerator = Class({}, "InsultGenerator")({
 
     // Super dumb pluralizer
     _pluralize : function _pluralize(noun) {
-      console.log(noun);
-      if (["a","e","i","o","u"].indexOf(noun[noun.length - 1]) >= 0) {
+      var lastLetter;
+
+      lastLetter = noun[noun.length - 1];
+
+      if (lastLetter === "s") {
+        return noun;
+      }
+
+      if (["a","e","i","o","u"].indexOf(lastLetter) >= 0) {
         return noun + "s"
       }