mirror of https://github.com/langgenius/dify.git
feat: Add polyfill for Array.prototype.toSpliced method
This commit is contained in:
parent
00af19c7f2
commit
91e23027f1
|
|
@ -1,5 +1,15 @@
|
|||
'use client'
|
||||
|
||||
// Polyfill for Array.prototype.toSpliced (ES2023, Chrome 110+)
|
||||
if (!Array.prototype.toSpliced) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Array.prototype.toSpliced = function <T>(this: T[], start: number, deleteCount?: number, ...items: T[]): T[] {
|
||||
const copy = this.slice()
|
||||
copy.splice(start, deleteCount ?? copy.length - start, ...items)
|
||||
return copy
|
||||
}
|
||||
}
|
||||
|
||||
class StorageMock {
|
||||
data: Record<string, string>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue