var Bones = Bones || {};
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
    module.exports = Bones;
}

Bones.camelize = function(text) {
    return text.replace(/(?:^|_)(.)/g, function(all, chr) {
        return chr.toUpperCase();
    });
};

Bones.underscoreify = function(text) {
    return text.replace(/[A-Z]/g, function(match) {
        return '_'+ match.toLowerCase();
    }).replace(/^_/, '');
};

Bones.singularize = function(text) {
    // Extend as necessary.
    // See https://github.com/visionmedia/lingo/blob/master/lib/languages/en.js.
    return text.replace(/s$/i, '');
};

Bones.pluralize = function(text) {
    // Extend as necessary.
    return text + 's';
};

@@ -663,54 +663,1000 @@
     
-// Extend as necessary.%0A    return text + 's';%0A%7D
+for (var i = Bones.pluralize.rules.length - 1; i %3E= 0; i--) %7B%0A        var rule = Bones.pluralize.rules%5Bi%5D;%0A        if (rule%5B0%5D.test(text)) %7B%0A            return text.replace(rule%5B0%5D, rule%5B1%5D);%0A        %7D%0A    %7D%0A    return text;%0A%0A%7D;%0A%0A// From https://github.com/visionmedia/lingo/blob/master/lib/languages/en.js%0ABones.pluralize.rules = %5B%0A    %5B (/$/), %22s%22 %5D,%0A    %5B (/(s%7Css%7Csh%7Cch%7Cx%7Co)$/i), %22$1es%22 %5D,%0A    %5B (/y$/i), %22ies%22 %5D,%0A    %5B (/(o%7Ce)y$/i), %22$1ys%22 %5D,%0A    %5B (/(octop%7Cvir)us$/i), %22$1i%22 %5D,%0A    %5B (/(alias%7Cstatus)$/i), %22$1es%22 %5D,%0A    %5B (/(bu)s$/i), %22$1ses%22 %5D,%0A    %5B (/(%5Bti%5D)um$/i), %22$1a%22 %5D,%0A    %5B (/sis$/i), %22ses%22 %5D,%0A    %5B (/(?:(%5B%5Ef%5D)fe%7C(%5Blr%5D)f)$/i), %22$1$2ves%22 %5D,%0A    %5B (/(%5B%5Eaeiouy%5D%7Cqu)y$/i), %22$1ies%22 %5D,%0A    %5B (/(matr%7Cvert%7Cind)(?:ix%7Cex)$/i), %22$1ices%22 %5D,%0A    %5B (/(%5Bm%7Cl%5D)ouse$/i), %22$1ice%22 %5D,%0A    %5B (/%5E(ox)$/i), %22$1en%22 %5D,%0A    %5B (/(quiz)$/i), %22$1zes%22 %5D,%0A    %5B (/%5Eperson$/i), %22people%22 %5D,%0A    %5B (/%5Eman$/i), %22men%22 %5D,%0A    %5B (/%5Echild$/i), %22children%22 %5D,%0A    %5B (/%5Emove$/i), %22moves%22 %5D,%0A    %5B (/%5Esex$/i), %22sexes%22 %5D%0A%5D
 ;%0A

properly pluralize words