Skip to content

Commit

Permalink
Adding Inflector methods to String
Browse files Browse the repository at this point in the history
  • Loading branch information
petebrowne committed Dec 13, 2010
1 parent 8077372 commit f83c91e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
10 changes: 10 additions & 0 deletions dist/classified.js
Expand Up @@ -786,6 +786,16 @@ classify(String, function() {
return this.replace(/[-_]+/g, ' ').capitalize();
});

// Returns the plural form of the word in the string.
def('pluralize', function() {
return Inflector.pluralize(this);
});

// The reverse of `pluralize`, returns the singular form of a word in a string.
def('singularize', function() {
return Inflector.singularize(this);
});

// Capitalizes all the words and replaces some characters in the string to create a nicer looking title.
def('titleize', function() {
return this.underscore().humanize().replace(/\b('?[a-z])/g, function(match, word) {
Expand Down
2 changes: 1 addition & 1 deletion dist/classified.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f83c91e

Please sign in to comment.