Fixes issues with global.

This commit is contained in:
Henning Dieterichs
2021-06-22 09:59:50 +02:00
parent 683f1e1f76
commit cd88168211
15 changed files with 281 additions and 240 deletions

View File

@@ -2,12 +2,22 @@ import { DataExtractorApiImpl } from "../api";
export function find(predicate: (obj: unknown) => boolean): unknown {
const processed = new Set();
if (!DataExtractorApiImpl.lastVariablesInScope) {
throw new Error("No variables in scope!");
if (!DataExtractorApiImpl.lastContext) {
throw new Error("No data extractor context!");
}
const values = Object.values(DataExtractorApiImpl.lastVariablesInScope);
const queue = [...values];
const values = Object.values(
DataExtractorApiImpl.lastContext.variablesInScope
);
const queue = [
...values.map((v) => {
try {
return v();
} catch (e) {
return undefined;
}
}),
];
let i = 10000;
while (i > 0) {