This repository is based on the inflection-js repository by Ryan Schuft hosted on Google Code.
Most of the code, however, was refactored by Jan Kuča. The new code is structured in one namespace that can be easily used with Google Closure Library and Compiler or as a Node.js module.
Google Closure Library:
goog.require('string.inflection');
Node.js:
require('inflection-js');
Note that you need to place the repository in your
node_modules
directory for the node.jsrequire
function to know about the module.
Ryan's original code extends String.prototype
which is generally considered a bad practice and it might not compile as well as a set of methods in a separated namespace.
-
string.inflection.toPlural(string): string
-
string.inflection.toSingular(string): string
-
string.inflection.toCamelCase(string): string
-
string.inflection.toPascalCase(string): string
-
string.inflection.toTitleCase(string): string
-
string.inflection.toUnderscored(string): string
-
string.inflection.toDashed(string): string
-
string.inflection.toCapitalized(string): string
-
string.inflection.toHumanized(string): string
-
string.inflection.toTableName(string): string
-
string.inflection.toClassName(string): string
-
string.inflection.toForeignKeyName(string): string
-
string.inflection.replaceNumbersWithOrdinals(string): string