},
_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) {
// 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"
}