docdef/source/outputs/implementations/json.ts

40 lines
528 B
TypeScript
Raw Normal View History

2024-02-08 10:41:17 +01:00
/**
*/
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"),
}
);
}
}
2024-02-08 11:10:07 +01:00
/**
*/
output_kind_register(
"json",
(data, sub) => (
new type_output_json(
{
}
)
)
);