Skip to content

Commit

Permalink
Update NewPolifills.js
Browse files Browse the repository at this point in the history
New polifill
  • Loading branch information
Trollhunters501 authored Jan 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 63ab8bb commit a1ce653
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libs/NewPolifills.js
Original file line number Diff line number Diff line change
@@ -9,6 +9,21 @@ Object.defineProperty(String.prototype, 'trimStart', {
return str;
}
});
Object.defineProperty(String.prototype, "insert", {
value: function(index, string){
if (index > 0) {
if (string.charCodeAt(0) == 13){
string = "\n";
}
let ret = this.substring(0, index) + string + this.substring(index, this.length);
return ret;
}else if (index == this.length) {
return this + string;
}else {
return string + this;
}
}
});
Object.defineProperty(String.prototype, 'trimEnd', {
value: function(){
let strn = this.toString();

0 comments on commit a1ce653

Please sign in to comment.