From a1ce653362d6afb5a6367f67a25debb21503f29d Mon Sep 17 00:00:00 2001 From: Trollhunters501 <91704943+Trollhunters501@users.noreply.github.com> Date: Fri, 12 Jan 2024 00:02:10 -0600 Subject: [PATCH] Update NewPolifills.js New polifill --- libs/NewPolifills.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/NewPolifills.js b/libs/NewPolifills.js index 541fde4..9095a3f 100644 --- a/libs/NewPolifills.js +++ b/libs/NewPolifills.js @@ -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();