Skip to content

Commit e50cdd0

Browse files
pimveldhuisenPim Veldhuisen
authored and
Pim Veldhuisen
committed
stop trimming whitespace when escaping strings
1 parent 2d7b997 commit e50cdd0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/openapi-typescript/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export function tsUnionOf(...types: (string | number | boolean)[]): string {
273273
/** escape string value */
274274
export function escStr(input: any): string {
275275
if (typeof input !== "string") return JSON.stringify(input);
276-
return `"${input.trim().replace(DOUBLE_QUOTE_RE, '\\"')}"`;
276+
return `"${input.replace(LB_RE, "").replace(DOUBLE_QUOTE_RE, '\\"')}"`;
277277
}
278278

279279
/** surround a JS object key with quotes, if needed */

0 commit comments

Comments
 (0)