{"bugs":{"url":"https://github.com/mathiasbynens/javascript-string-escape/issues"},"dist":{"shasum":"570c9c25f6805681f68afa804970c59792c48fe9","tarball":"https://registry.npmjs.org/string-escape/-/string-escape-0.1.0.tgz","integrity":"sha512-/BWs3pOzoQ4YyN/pAJSGp3ouOSj/eB66UAz6hHnVJSWsycgisardbZKaCXgkYgxWKqBEdY69kW1d6KhdaeU+tw==","signatures":[{"sig":"MEQCIAa+av46ekU/5oRy6PGA+AjHCX0/5V2N9Vkl1HRiO7/dAiBM721UwE1lv/etsbZ+yG0C4MbwbeuJAYMGb+f4W8yRJA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"string-escape.js","name":"string-escape","_from":".","author":{"url":"http://mathiasbynens.be/","name":"Mathias Bynens"},"readme":"# JavaScript string escape [![Build status](https://travis-ci.org/mathiasbynens/javascript-string-escape.png?branch=master)](https://travis-ci.org/mathiasbynens/javascript-string-escape) [![Dependency status](https://gemnasium.com/mathiasbynens/javascript-string-escape.png)](https://gemnasium.com/mathiasbynens/javascript-string-escape)\n\nThis is a JavaScript library for escaping JavaScript strings while generating the shortest possible valid output.\n\nFeel free to fork if you see possible improvements!\n\n## Installation\n\nIn a browser:\n\n```html\n<script src=\"string-escape.js\"></script>\n```\n\nVia [npm](http://npmjs.org/):\n\n```bash\nnpm install string-escape\n```\n\nIn [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS](http://ringojs.org/):\n\n```js\nvar stringEscape = require('string-escape');\n```\n\nIn [Rhino](http://www.mozilla.org/rhino/):\n\n```js\nload('string-escape.js');\n```\n\nUsing an AMD loader like [RequireJS](http://requirejs.org/):\n\n```js\nrequire(\n  {\n    'paths': {\n      'string-escape': 'path/to/string-escape'\n    }\n  },\n  ['string-escape'],\n  function(stringEscape) {\n    console.log(stringEscape);\n  }\n);\n```\n\n## API\n\n### `stringEscape(string, options)`\n\nThis function takes a string and returns an escaped version of the string where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in JavaScript strings](http://mathiasbynens.be/notes/javascript-escapes).\n\n```js\nstringEscape('Ich ♥ Bücher');\n// → 'Ich \\\\u2665 B\\\\xFCcher'\n\nstringEscape('foo 𝌆 bar');\n// → 'foo \\\\uD834\\\\uDF06 bar'\n```\n\nThe optional `options` argument accepts an object with the following options:\n\n#### `quotes`\n\nThe default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input string will be escaped as `\\'`, so that the output can be used in a string literal wrapped in single quotes.\n\n```js\nstringEscape('Lorem ipsum \"dolor\" sit \\'amet\\' etc.');\n// → 'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.'\n\nstringEscape('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n  'quotes': 'single'\n});\n// → 'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.'\n// → \"Lorem ipsum \\\"dolor\\\" sit \\\\'amet\\\\' etc.\"\n```\n\nIf you want to use the output as part of a string literal wrapped in double quotes, set the `quotes` option to `'double'`.\n\n```js\nstringEscape('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n  'quotes': 'double'\n});\n// → 'Lorem ipsum \\\\\"dolor\\\\\" sit \\'amet\\' etc.'\n// → \"Lorem ipsum \\\\\\\"dolor\\\\\\\" sit 'amet' etc.\"\n```\n\n### `stringEscape.version`\n\nA string representing the semantic version number.\n\n## Support\n\nThis library has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4.\n\n## Unit tests & code coverage\n\nAfter cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.\n\nOnce that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.\n\nTo generate [the code coverage report](http://rawgithub.com/mathiasbynens/javascript-string-escape/master/coverage/string-escape/string-escape.js.html), use `grunt cover`.\n\n## Author\n\n| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](http://mathiasbynens.be/) |\n\n## License\n\nThis library is dual licensed under the [MIT](http://mths.be/mit) and [GPL](http://mths.be/gpl) licenses.\n","scripts":{"test":"node tests/tests.js"},"_npmUser":{"name":"mathias","email":"mathias@qiwi.be"},"homepage":"http://mths.be/stringescape","keywords":["string","escape","tool"],"licenses":[{"url":"http://mths.be/mit","type":"MIT"},{"url":"http://mths.be/gpl","type":"GPL"}],"deprecated":"Package has been deprecated in favor of `jsesc`. Please `npm install jsesc` instead.","repository":{"url":"https://github.com/mathiasbynens/javascript-string-escape.git","type":"git"},"_npmVersion":"1.2.19","description":"A JavaScript library for escaping JavaScript strings while generating the shortest possible valid output.","directories":{"test":"tests"},"maintainers":[{"name":"mathias","email":"mathias@qiwi.be"}],"dependencies":{},"readmeFilename":"README.md","devDependencies":{"grunt":"~0.4.1","qunitjs":"~1.11.0","istanbul":"~0.1.36","requirejs":"~2.1.6","qunit-clib":"~1.3.0","regenerate":"~0.5.1","grunt-shell":"~0.2.2","grunt-template":"~0.1.0"},"_id":"string-escape@0.1.0","version":"0.1.0"}