#49 | created JSON escaper tool

This commit is contained in:
Aneek Ghosh
2025-03-29 18:01:50 +05:30
parent 4b2d38cae3
commit 3818c9315a
5 changed files with 142 additions and 3 deletions

View File

@@ -0,0 +1,7 @@
export const escapeJson = (input: string, wrapInQuotesFlag: boolean) => {
const escapedJson = JSON.stringify(input);
if (!wrapInQuotesFlag) {
return escapedJson.slice(1, -1);
}
return escapedJson;
};