Implements tryEval.

This commit is contained in:
Henning Dieterichs
2020-02-12 19:04:59 +01:00
parent 17e362aaa9
commit fbcc852fc2
5 changed files with 62 additions and 4 deletions

View File

@@ -17,10 +17,12 @@ export interface DataExtractorApi {
registerExtractors(extractors: DataExtractor<ExtractedData>[]): void;
/**
* Extracts data from `value`.
* Extracts data from the result of `valueFn`.
* @valueFn a function returning the value to extract the data from.
* Is a function so that it's evaluation can depend on `evalFn`.
*/
getData(
value: unknown,
valueFn: () => unknown,
evalFn: <T>(expression: string) => T,
preferredDataExtractorId: string | undefined
): JSONString<DataResult>;