don't crash when uppercasing an empty string
All checks were successful
PR Check / lint-and-format (pull_request) Successful in 18s
All checks were successful
PR Check / lint-and-format (pull_request) Successful in 18s
This commit is contained in:
parent
fc189ab552
commit
d3251fd50a
1 changed files with 4 additions and 0 deletions
|
@ -12,5 +12,9 @@ declare global {
|
|||
|
||||
/** Capitalize definition */
|
||||
String.prototype.capitalize = function (this: string) {
|
||||
if (this.length === 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
return this[0].toUpperCase() + this.substring(1);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue