lib/utils/helpers.js
function strToCase(str, casing) {

            casing = casing === 'capitalize' ? 'first' : casing;

            if (!casing) return str;
            casing = casing || 'first';
            if (casing === 'lower')
                return str.toLowerCase();
            if (casing === 'upper')
                return str.toUpperCase();
            if (casing == 'title')
                return str.replace(/\w\S*/g, function (txt) {
                    return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
                });
            if (casing == 'first')
                return str.charAt(0).toUpperCase() + str.slice(1);
            if (casing == 'camel') {
                return str.toLowerCase().replace(/-(.)/g, function (match, group1) {
                    return group1.toUpperCase();
                });
            }
            if (casing == 'pascal')
                return str.replace(/\w+/g, function (w) {
                    return w[0].toUpperCase() + w.slice(1).toLowerCase();
                });
            return str;
        }
function strToCase(str, casing) {

            casing = casing === 'capitalize' ? 'first' : casing;

            if (!casing) return str;
            casing = casing || 'first';
            if (casing === 'lower')
                return str.toLowerCase();
            if (casing === 'upper')
                return str.toUpperCase();
            if (casing == 'title')
                return str.replace(/\w\S*/g, function (txt) {
                    return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
                });
            if (casing == 'first')
                return str.charAt(0).toUpperCase() + str.slice(1);
            if (casing == 'camel') {
                return str.toLowerCase().replace(/-(.)/g, function (match, group1) {
                    return group1.toUpperCase();
                });
            }
            if (casing == 'pascal')
                return str.replace(/\w+/g, function (w) {
                    return w[0].toUpperCase() + w.slice(1).toLowerCase();
                });
            return str;
        }
function strToCase ( str , casing ) { casing = casing === 'capitalize' ? 'first' : casing ; if ( ! casing ) return str ; casing = casing || 'first' ; if ( casing === 'lower' ) return str . toLowerCase ( ) ; if ( casing === 'upper' ) return str . toUpperCase ( ) ; if ( casing == 'title' ) return str . replace ( / \w\S* / g , function ( txt ) { return txt . charAt ( 0 ) . toUpperCase ( ) + txt . substr ( 1 ) . toLowerCase ( ) ; } ) ; if ( casing == 'first' ) return str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ; if ( casing == 'camel' ) { return str . toLowerCase ( ) . replace ( / -(.) / g , function ( match , group1 ) { return group1 . toUpperCase ( ) ; } ) ; } if ( casing == 'pascal' ) return str . replace ( / \w+ / g , function ( w ) { return w [ 0 ] . toUpperCase ( ) + w . slice ( 1 ) . toLowerCase ( ) ; } ) ; return str ; }
Converts the case of a string.
@memberof Helpers
@param {string} str - the string to convert.
@param {string} casing - case to convert to ex: 'first', 'upper', 'title', 'camel', 'pascal'
Converts the case of a string .