| 1 | // Polyfills for old Safari versions |
| 2 | if (!Object.hasOwn) { |
| 3 | Object.hasOwn = function (obj, prop) { return obj.hasOwnProperty(prop); } |
| 4 | } |
| 5 | |
| 6 | if (!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 | |
| 15 | if (!Array.prototype.toSorted) { |
| 16 | Array.prototype.toSorted = function (compareFunction) { |
| 17 | return this.slice().sort(compareFunction); |
| 18 | }; |
| 19 | } |