@firfi/quint-connect
Version:
Model-based testing framework connecting Quint specifications to TypeScript implementations
17 lines • 660 B
JavaScript
import { Predicate } from "effect";
/** @internal */
export const stripMetadata = (state) => Object.fromEntries(Object.entries(state).filter(([k]) => k !== "#meta" && !k.startsWith("mbt::")));
export const resolveNestedValue = (obj, path) => {
let current = obj;
for (const key of path) {
if (!Predicate.isRecord(current) || !(key in current)) {
return undefined;
}
current = current[key];
}
return current;
};
export const normalizeTraceState = (rawState, statePath) => statePath.length > 0
? resolveNestedValue(rawState, statePath)
: stripMetadata(rawState);
//# sourceMappingURL=trace-state.js.map