add string extension for capitalize string
This commit is contained in:
parent
b3d8755b7d
commit
9ed2138bab
1 changed files with 16 additions and 0 deletions
16
src/modules/string.ts
Normal file
16
src/modules/string.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
export {};
|
||||
|
||||
declare global {
|
||||
// Declarations
|
||||
interface String {
|
||||
/**
|
||||
* Returns a copy of the string with the first letter capitalized.
|
||||
*/
|
||||
capitalize(): string,
|
||||
}
|
||||
}
|
||||
|
||||
/** Capitalize definition */
|
||||
String.prototype.capitalize = function(this: string) {
|
||||
return this[0].toUpperCase() + this.substring(1);
|
||||
};
|
Loading…
Reference in a new issue