Blame Raw
· · · 19 lines (558 B)
0 contributors
1// Polyfills for old Safari versions
2if (!Object.hasOwn) {
3 Object.hasOwn = function (obj, prop) { return obj.hasOwnProperty(prop); }
4}
5
6if (!Array.prototype.findLastIndex) {
7 Array.prototype.findLastIndex = function (callback, thisArg) {
8 for (let i = this.length - 1; i >= 0; i--) {
9 if (callback.call(thisArg, this[i], i, this)) return i;
10 }
11 return -1;
12 };
13}
14
15if (!Array.prototype.toSorted) {
16 Array.prototype.toSorted = function (compareFunction) {
17 return this.slice().sort(compareFunction);
18 };
19}