Permalink
Browse files

Added single getInflection method for string

  • Loading branch information...
1 parent ed3ccf6 commit 960f8c8e754f2ba3354b311c29fa9ecfde803755 mde committed Mar 28, 2013
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/string.js
View
@@ -697,27 +697,13 @@ string = new (function () {
@return {Object} A Object containing multiple different inflects for the given `name`
@description Inflection returns an object that contains different inflections
created from the given `name`
- @param {String} string The string to create inflections from
- @param {Object} options
- @param {Boolean} [options.initialCap]
+ @param {String} name The string to create inflections from
*/
- this.getInflections = function (name, options) {
- var opts = options || {}
- , initialCap;
-
+ this.getInflections = function (name) {
if (!name) {
return;
}
- // Backward-compat
- if (typeof opts == 'boolean') {
- opts = {
- initialCap: true
- };
- }
-
- initialCap = opts.initialCap;
-
var self = this
// Use plural version to fix possible mistakes(e,g,. thingie instead of thingy)
, normalizedName = this.snakeize(inflection.pluralize(name))
@@ -748,6 +734,20 @@ string = new (function () {
};
};
+ /**
+ @name string#getInflection
+ @public
+ @function
+ @return {Object} A Object containing multiple different inflects for the given `name`
+ @description Inflection returns an object that contains different inflections
+ created from the given `name`
+ @param {String} name The string to create inflections from
+ */
+ this.getInflection = function (name, key, pluralization) {
+ var infl = this.getInflections(name);
+ return infl[key][pluralization];
+ };
+
// From Math.uuid.js, https://github.com/broofa/node-uuid
// Robert Kieffer (robert@broofa.com), MIT license
this.uuid = function (length, radix) {

0 comments on commit 960f8c8

Please sign in to comment.