mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
chore: polyfill Array.at for old browsers
This commit is contained in:
parent
9f348b70d6
commit
c758e19e90
3 changed files with 11 additions and 2 deletions
|
|
@ -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* () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue