We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b6c77f commit d6a0e0eCopy full SHA for d6a0e0e
src/value/FnValue.ts
@@ -0,0 +1,15 @@
1
+import {Value} from './Value';
2
+import type {Printable} from 'tree-dump/lib/types';
3
+import type * as classes from '../type';
4
+
5
+export class FnValue<T extends classes.FnType<any, any, any>> extends Value<T> implements Printable {
6
+ public async exec(input: classes.ResolveType<T['req']>, ctx?: unknown): Promise<Value<T['res']>> {
7
+ const fn = this.data as any;
8
+ const output = await fn(input, ctx);
9
+ return new Value(output, this.type!.res);
10
+ }
11
12
+ public name(): string {
13
+ return 'FnValue';
14
15
+}
0 commit comments