
(function($) {

    $.ucFirst = function(str,allWords=false) {

        let text='';

        if(allWords){
            let parts = str.split(' '),
                len = parts.length,
                i, words = [];
            for (i = 0; i < len; i++) {
                let part = parts[i];
                let first = part[0].toUpperCase();
                let rest = part.substring(1, part.length);
                let word = first + rest;
                words.push(word);

            }
            text=words.join(' ');
        }else{
            str += '';
            const f = str.charAt(0)
                .toUpperCase();
            text= f + str.substr(1);
        }
        return text;

    };
})(jQuery);

(function($) {

    $.lcFirst = function(str,allWords=false) {

        let text='';
        if(allWords){
            let parts = str.split(' '),
                len = parts.length,
                i, words = [];
            for (i = 0; i < len; i++) {
                let part = parts[i];
                let first = part[0].toLowerCase();
                let rest = part.substring(1, part.length);
                let word = first + rest;
                words.push(word);

            }
            text=words.join(' ');
        }else{
            str += '';
            const f = str.charAt(0)
                .toLowerCase();
            text= f + str.substr(1);
        }
        return text;
    };
})(jQuery);
