Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Closes geddy/geddy#269 Attempt to fix incorrect misspellings

automatically by changing it to it's plural version first and using that
to generate it's inflections.

Example:
thingie vs thingy

Also included a function callback check in string#truncate, because
Handlebars like to include a third argument for no apparent reason.
  • Loading branch information...
commit a6a35e2f5105fc1d5e242e9bce4355ea046043fe 1 parent a63ebb4
Larz Conwell larzconwell authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/string.js
5 lib/string.js
View
@@ -412,7 +412,7 @@ string = new (function () {
}
else {
returnString = str.substring(0, last) + opts.omission;
- returnString += callback ? callback() : '';
+ returnString += callback && typeof callback === 'function' ? callback() : '';
return returnString;
}
};
@@ -719,7 +719,8 @@ string = new (function () {
initialCap = opts.initialCap;
var self = this
- , normalizedName = this.snakeize(name)
+ // Use plural version to fix possible mistakes(e,g,. thingie instead of thingy)
+ , normalizedName = this.snakeize(inflection.pluralize(name))
, nameSingular = inflection.singularize(normalizedName)
, namePlural = inflection.pluralize(normalizedName);
Please sign in to comment.
Something went wrong with that request. Please try again.