]> git.r.bdr.sh - rbdr/generador-de-insultos/blobdiff - lib/InsultGenerator.js
Makes all nouns lowercase
[rbdr/generador-de-insultos] / lib / InsultGenerator.js
index e5ad2930906c796feb34b4e134a3e5568a8d15df..7951204f503bf42d0cbea73420020411dee49802 100644 (file)
@@ -149,9 +149,9 @@ var InsultGenerator = Class({}, "InsultGenerator")({
     },
 
     _getNoun : function _getNoun() {
-      var index;
+      var index, noun;
       index = Math.floor(Math.random()*this.nouns.length);
-      return Promise.resolve(this.nouns[index]);
+      return Promise.resolve(this.nouns[index].toLowerCase());
     },
 
     _generateInsult : function _generateInsult(verb, noun) {
@@ -161,7 +161,7 @@ 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) {
+      if (["a","e","i","o","u"].indexOf(noun[noun.length - 1]) >= 0) {
         return noun + "s"
       }