X-Git-Url: https://git.r.bdr.sh/rbdr/generador-de-insultos/blobdiff_plain/1a652aac0ac1efc9100dd25e7da1105a4d515dc4..f66f0639a6b320722f4c5d2f294f133fb04bcd54:/lib/InsultGenerator.js?ds=inline diff --git a/lib/InsultGenerator.js b/lib/InsultGenerator.js index e5ad293..7951204 100644 --- a/lib/InsultGenerator.js +++ b/lib/InsultGenerator.js @@ -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" }