mirror of
https://github.com/actions/github-script.git
synced 2026-08-28 03:09:21 +00:00
Add tests for the AsyncFunction
This commit is contained in:
parent
6eefe48bc9
commit
38e3ffe4c6
7 changed files with 4679 additions and 100 deletions
11
src/async-function.ts
Normal file
11
src/async-function.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor
|
||||
|
||||
type AsyncFunctionArguments = {[key: string]: any}
|
||||
|
||||
export async function callAsyncFunction(
|
||||
args: AsyncFunctionArguments,
|
||||
source: string
|
||||
): Promise<any> {
|
||||
const fn = new AsyncFunction(...Object.keys(args), source)
|
||||
return fn(...Object.values(args))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue