0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00
This commit is contained in:
Jesse Jackson 2021-01-21 19:09:07 -06:00 committed by GitHub
parent bdb1ee6480
commit ffa920e4b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ function getEscapedString(value: unknown, sep: string): string {
if (typeof value === "object") str = JSON.stringify(value);
else str = String(value);
// Is regex.test more performance here? If so, how to dynamically create?
// Is regex.test more performant here? If so, how to dynamically create?
// https://stackoverflow.com/questions/3561493/
if (str.includes(sep) || str.includes(NEWLINE) || str.includes(QUOTE)) {
return `${QUOTE}${str.replaceAll(QUOTE, `${QUOTE}${QUOTE}`)}${QUOTE}`;