docdef/source/outputs/implementations/json.ts
2024-02-08 11:10:07 +01:00

40 lines
528 B
TypeScript

/**
*/
class type_output_json implements type_output<string>
{
public readonly kind : string = "json";
public readonly data : {};
public constructor(data : {}) {this.data = data;}
/**
*/
public render_element(
element : type_element
) : string
{
return lib_plankton.call.distinguish<string>(
element,
{
},
{
"fallback": (element) => JSON.stringify(element, undefined, "\t"),
}
);
}
}
/**
*/
output_kind_register(
"json",
(data, sub) => (
new type_output_json(
{
}
)
)
);