From c758e19e9069f8084e85622bbd11d6f9f929f26f Mon Sep 17 00:00:00 2001 From: Azgaar Date: Tue, 5 Dec 2023 02:38:37 +0400 Subject: [PATCH] chore: polyfill Array.at for old browsers --- index.html | 2 +- utils/polyfills.js | 9 +++++++++ versioning.js | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index f8e89f38..8a39f5b8 100644 --- a/index.html +++ b/index.html @@ -7966,7 +7966,7 @@ - + diff --git a/utils/polyfills.js b/utils/polyfills.js index 667d81ab..ffc10f74 100644 --- a/utils/polyfills.js +++ b/utils/polyfills.js @@ -15,6 +15,15 @@ if (Array.prototype.flat === undefined) { }; } +// at +if (Array.prototype.at === undefined) { + Array.prototype.at = function (index) { + if (index < 0) index += this.length; + if (index < 0 || index >= this.length) return undefined; + return this[index]; + }; +} + // readable stream iterator: https://bugs.chromium.org/p/chromium/issues/detail?id=929585#c10 if (ReadableStream.prototype[Symbol.asyncIterator] === undefined) { ReadableStream.prototype[Symbol.asyncIterator] = async function* () { diff --git a/versioning.js b/versioning.js index 26625d25..0d0d6f8a 100644 --- a/versioning.js +++ b/versioning.js @@ -1,7 +1,7 @@ "use strict"; // version and caching control -const version = "1.95.02"; // generator version, update each time +const version = "1.95.03"; // generator version, update each time { document.title += " v" + version;