Feature/turbopack * . * . * pin import-in-the-middle * update marker * revert back to using *.graphql.ts Approved-by: Linus Flood
29 lines
598 B
TypeScript
29 lines
598 B
TypeScript
export {}
|
|
|
|
if (!Array.prototype.at) {
|
|
Array.prototype.at = function (index: number) {
|
|
// Convert the index to an integer
|
|
index = Math.trunc(index) || 0
|
|
if (index < 0) {
|
|
index += this.length
|
|
}
|
|
if (index < 0 || index >= this.length) {
|
|
return undefined
|
|
}
|
|
return this[index]
|
|
}
|
|
}
|
|
|
|
if (!String.prototype.at) {
|
|
String.prototype.at = function (index: number) {
|
|
index = Math.trunc(index) || 0
|
|
if (index < 0) {
|
|
index += this.length
|
|
}
|
|
if (index < 0 || index >= this.length) {
|
|
return undefined
|
|
}
|
|
return this.charAt(index)
|
|
}
|
|
}
|