MCPcopy
hub / github.com/microsoft/vscode-js-debug / wrapObjectLiteral

Function wrapObjectLiteral

src/common/sourceUtils.ts:207–223  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

205 * for other expression or invalid code.
206 */
207export function wrapObjectLiteral(code: string): string {
208 try {
209 const expr = parseExpressionAt(code, 0, acornOptions);
210 if (expr.end < code.length) {
211 return code;
212 }
213
214 const cast = expr as Expression;
215 if (cast.type !== 'ObjectExpression') {
216 return code;
217 }
218
219 return `(${code})`;
220 } catch {
221 return code;
222 }
223}
224
225export function parseSourceMappingUrl(content: string): string | undefined {
226 if (!content) return;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected