mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-09-16 19:13:42 +00:00
new polyfill
This commit is contained in:
@@ -48,6 +48,18 @@ function defineItter(itter: typeof Iterator) {
|
||||
i++;
|
||||
}
|
||||
};
|
||||
itter.prototype.find ??= function find<U>(
|
||||
callbackfn: (element: U, index: number) => boolean,
|
||||
): U | undefined {
|
||||
let i = 0;
|
||||
for (const thing of this) {
|
||||
if (callbackfn(thing, i)) {
|
||||
return thing;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
if ("Iterator" in globalThis) {
|
||||
defineItter(globalThis.Iterator);
|
||||
|
||||
Reference in New Issue
Block a user