Here you can find the source of toCap()
'use strict'/*from w w w .ja v a 2 s . co m*/ export default (obj) => String.prototype.toCap.apply(obj) String.prototype.toCap = function () { return this.toUpperCase().charAt(0) + this.slice(1,(this.length)); }
String.prototype.snakeCaseDash = function() { return this.replace( /([A-Z])/g, function( $1 ) {return "-" + $1.toLowerCase();} ); };
String.prototype.snake_case = function(){ return this .replace( /[A-Z]/g, function($1) { return '_' + $1 } ) .toLowerCase();
String.prototype.toSnakeCase = function(){ return this.replace(/([A-Z])/g, function($1){return "_"+$1.toLowerCase();}); };
String.prototype.toCap = function () { var result = this.toUpperCase().charAt(0) + this.slice(1, this.length); return result; };
String.prototype.toCap = function() { var string = this.toString(); if(!string.length) return; var lastName = string.split(' ').pop(); var firstName = string.split(' ')[0]; lastName = lastName[0].toUpperCase() + lastName.slice(1); firstName = firstName[0].toUpperCase() + firstName.slice(1); string = firstName + " " + lastName; return string; ...