MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / unprettifyJsonString

Function unprettifyJsonString

lib/embed-docs/utils.ts:186–197  ·  view source on GitHub ↗
(jsonString: string)

Source from the content-addressed store, hash-verified

184}
185
186export function unprettifyJsonString(jsonString: string): string {
187 // Convert all comments to /* */ style
188 let noWhiteSpace = jsonString.replace(/\/\/(.*)/g, "/*$1*/");
189 noWhiteSpace = noWhiteSpace.replace(/\/\*((.|\n|\r)*)\*\//g, "/*$1*/");
190
191 // Unprettify JSON by removal of line breaks, tabs, and excessive spaces
192 noWhiteSpace = noWhiteSpace.trim().replace(/[\r\n\t ]*\n[\r\n\t ]*/g, "");
193 noWhiteSpace = noWhiteSpace.replace(/[\r\n\t ]+/g, " ");
194 noWhiteSpace = noWhiteSpace.replace(/, /g, ",");
195 noWhiteSpace = noWhiteSpace.replace(/": "/g, '":"');
196 return noWhiteSpace;
197}
198
199export function splitMarkdownIntoSentences(markdown: string): string[] {
200 /** Does what it says on the tin.

Callers 1

splitOutCodeChunksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected