mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 08:05:19 +00:00
18 lines
414 B
TypeScript
18 lines
414 B
TypeScript
/**
|
|
* Stringify an OpenAPI object. Same API as JSON.stringify.
|
|
*/
|
|
export function stringifyOpenAPI(body: unknown, _?: null, indent?: number): string {
|
|
return JSON.stringify(
|
|
body,
|
|
(key, value) => {
|
|
// Ignore internal keys
|
|
if (key.startsWith('x-gitbook-')) {
|
|
return undefined;
|
|
}
|
|
|
|
return value;
|
|
},
|
|
indent
|
|
);
|
|
}
|