-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
227 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* in preload */ | ||
export {} | ||
declare global { | ||
interface Object { | ||
fromEntries<T, K extends string | number | symbol>(entries: [K, T][]): Record<K, T> | ||
} | ||
interface Array<T> { | ||
flat(): T extends Array<any> ? T : T[] | ||
flatMap<U>(callback: (value: T, index: number, array: T[]) => U | U[], thisArg?: this | undefined): U[] | ||
} | ||
} | ||
|
||
if (!Object.fromEntries) { | ||
Object.fromEntries = function <T, K extends string | number | symbol>(entries: [K, T][]): Record<K, T> { | ||
return entries.reduce( | ||
(acc: Record<K, T>, e: [K, T]) => { | ||
acc[e[0]] = e[1] | ||
return acc | ||
}, | ||
{} as Record<K, T> | ||
) | ||
} | ||
} | ||
|
||
if (!Array.prototype.flat) { | ||
Array.prototype.flat = function <T>(this: T[][]): T[] { | ||
return this.reduce((acc, val) => acc.concat(val), []) | ||
} | ||
} | ||
|
||
if (!Array.prototype.flatMap) { | ||
Array.prototype.flatMap = function (callback, ...args) { | ||
return this.map(callback, ...args).flat() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters