{"_id":"quote-js-string","name":"quote-js-string","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"quote-js-string","version":"0.1.0","description":"Escape a string and wrap it in quotes to produce a safe JavaScript string literal","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/quote-js-string.git"},"funding":"https://github.com/sindresorhus/quote-js-string?sponsor=1","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=22"},"scripts":{"test":"xo && node --test"},"keywords":["escape","quote","string","literal","string-literal","javascript","js","source","codegen","sanitize","safe"],"devDependencies":{"xo":"^3.0.2"},"gitHead":"331a0662c0088a06ac7974581526745c4c9fbb7c","types":"./index.d.ts","_id":"quote-js-string@0.1.0","bugs":{"url":"https://github.com/sindresorhus/quote-js-string/issues"},"homepage":"https://github.com/sindresorhus/quote-js-string#readme","_nodeVersion":"22.22.3","_npmVersion":"11.18.0","dist":{"integrity":"sha512-Y3NoRtprEEZQD8RfxMCfS0ZTqc4e+i18OrXEXAvpM6TfC/3y+0L5rNbZiSnbBBEkDfFzbpd8o+cE8q3/anjMGA==","shasum":"812aef957a2dfb31d32f0d9e9662fe558bc9842b","tarball":"https://registry.npmjs.org/quote-js-string/-/quote-js-string-0.1.0.tgz","fileCount":5,"unpackedSize":5261,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDT9d0m+1DOO+Nk+rzb9lfE+f3KxQMvOhoyhmdcQ3QnyAIgEoiGH7E+pEX8heqOA3GnmWtb270hYe5Lf4tmYBltAGw="}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/quote-js-string_0.1.0_1782999730722_0.8662679825344717"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-02T13:42:10.637Z","0.1.0":"2026-07-02T13:42:10.893Z","modified":"2026-07-02T13:42:11.174Z"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"description":"Escape a string and wrap it in quotes to produce a safe JavaScript string literal","homepage":"https://github.com/sindresorhus/quote-js-string#readme","keywords":["escape","quote","string","literal","string-literal","javascript","js","source","codegen","sanitize","safe"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/quote-js-string.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"bugs":{"url":"https://github.com/sindresorhus/quote-js-string/issues"},"license":"MIT","readme":"# quote-js-string\n\n> Escape a string and wrap it in quotes to produce a safe JavaScript string literal\n\nUseful for code generators, ESLint autofixers, and other tooling that needs to turn an arbitrary runtime string into JavaScript source code.\n\nEscapes backslashes, the quote character, and unsafe characters (C0 control characters, DEL, the U+2028/U+2029 line terminators, which can disrupt line-oriented tooling, and lone surrogates, which have no valid UTF-8 representation).\n\n## Install\n\n```sh\nnpm install quote-js-string\n```\n\n## Usage\n\n```js\nimport quoteJsString from 'quote-js-string';\n\nquoteJsString('It\\'s a test');\n//=> `'It\\\\'s a test'`\n\nquoteJsString('It\\'s a test', '\"');\n//=> `\"It's a test\"`\n\nquoteJsString('line1\\nline2');\n//=> `'line1\\\\nline2'`\n```\n\n## API\n\n### quoteJsString(string, quote?)\n\n#### string\n\nType: `string`\n\nThe string to quote and escape.\n\n#### quote\n\nType: `'` | `\"`\\\nDefault: `'`\n\nThe quote character to wrap the string in.\n","readmeFilename":"readme.md","_rev":"1-a2ede3898d4bbd04ecd05face504b2d1"}