@scalar/api-client
Version:
the open source API testing client
23 lines (22 loc) • 635 B
JavaScript
import { xScalarEnvironmentSchema as r } from "@scalar/workspace-store/schemas/extensions/document/x-scalar-environments";
import { coerceValue as a } from "@scalar/workspace-store/schemas/typebox-coerce";
const s = (e, o) => {
if (e === null)
return a(r, {});
const n = e.workspace["x-scalar-active-environment"];
if (!n)
return a(r, {});
const t = e.workspace["x-scalar-environments"]?.[n] ?? {
variables: []
}, i = o?.["x-scalar-environments"]?.[n] ?? {
variables: []
};
return a(r, {
...t,
...i,
variables: [...t.variables, ...i.variables]
});
};
export {
s as getActiveEnvironment
};