{"name":"escaper","description":"Small JavaScript library for replacing string literals, regular expressions and comments in JavaScript syntax.","homepage":"https://github.com/kobezzza/Escaper","main":"dist/escaper.js","module":"src/escaper.js","typings":"escaper.d.ts","version":"3.0.3","license":"MIT","author":{"name":"kobezzza","email":"kobezzza@mail.ru","url":"https://github.com/kobezzza"},"repository":{"type":"git","url":"git://github.com/kobezzza/Escaper.git"},"bugs":{"url":"https://github.com/kobezzza/Escaper/issues"},"scripts":{"test":"bower install && jasmine","test-coverage":"gulp test && gulp test:dev","full-test":"npm run test-coverage && yaspeller ./"},"keywords":["javascript","string"],"devDependencies":{"@babel/core":"^7.5.5","@babel/preset-env":"^7.5.5","@types/gulp":"^4.0.6","@types/gulp-load-plugins":"0.0.31","babel-eslint":"^10.0.2","bower":"^1.8.8","closurecompiler-externs":"^1.0.4","collection.js":"^6.7.10","coveralls":"^3.0.5","eslint":"^6.1.0","glob":"^7.1.4","gulp":"^4.0.2","gulp-bump":"^3.1.3","gulp-closure-compiler":"^0.4.0","gulp-download":"0.0.1","gulp-eol":"^0.2.0","gulp-header":"^2.0.9","gulp-ignore":"^3.0.0","gulp-istanbul":"^1.1.3","gulp-jasmine":"^4.0.0","gulp-load-plugins":"^2.0.0","gulp-monic":"^2.0.14","gulp-plumber":"^1.2.1","gulp-replace":"^1.0.0","gulp-run":"^1.6.8","gulp-wrap":"^0.15.0","jasmine":"^3.4.0","monic":"^2.6.0","rollup":"^1.17.0","rollup-plugin-babel":"^4.3.3","through2":"^3.0.1","vinyl":"^2.2.0","yaspeller":"^6.0.0"},"gitHead":"216093f62c3fde9118df3524637fee49f689d8fc","_id":"escaper@3.0.3","_nodeVersion":"12.6.0","_npmVersion":"6.10.1","dist":{"integrity":"sha512-vspXdaMYWzEqpbym0NNU/cyDs2hH5JJGIqplEty9jsZfmYGTMyCt15c9yKoAtIdDOHipjYmCJVQwZ6wO8zXX6Q==","shasum":"e6230434407ee04f6c75ba3e6517a571886739be","tarball":"http://registry-npm.ywwl.com/escaper/download/escaper-3.0.3.tgz","fileCount":14,"unpackedSize":40937,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdOdsTCRA9TVsSAnZWagAA1OYP/RKyvjoKdu8+r9duwib8\natqhNZDGlSmApuucsuhIi0hiaMgnkKuM7bpjbfM2KsbmZ82VWkbKZ+W/4Ned\n8uGeBcDOnawRWQsUpIlPzXWkILvIg/GS5L3tCeKfX1qBtxGm1+St9ce9WE2a\nOH6Mt/QCOsRpzOrfPFAf7wpxzkzQyexS58oFTuA34QeCaK4JZzo1MocS7dRA\nuvh8ROIga45OU54F+hnJlOfQSfLcnG1OoDMnsReUKQR+ZdzKMDE5QRsA2/iL\nyo4x2EOV7/DjYCs+AIC1VpKlO1/6sMXcpQA9LJ+c8/aVkmp4fiCc+cZqt4co\nOeTPIDckU0TDzJAvF+2BeXAk5NoyQveXSFLyZ7Q+TbwKOo0+AhGmdBy3ADYP\ndg9n2vWVTFpiYsMQpffvMJeL0tPV40tQfmlUfWNN16m+2oyFR3ZeniNahW0H\nYNeKr5FWt/zVnXnJHGc6UBHTfbDNmWUvanQd2QX16iVSCMCO/Xuym5LTMTIv\nj6kwlcxs8bl/XKbvNx0D5LQL0g9yxGt4crK82cJGupZFw5qkMfnJ3LY5cNB+\npcA5wthaB80H7UOZDdH8aR/uvrwtFGBneilb/XTsTZO8g8NGrlHocmwbnF9v\nstOjEvlBokNSc54sOt082RjFeZtI+LnlKkaVt4X5z2AV1EGajeUd3nmY8IdP\n0U/l\r\n=iIRT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDt0zLuJulFcdOOKJpAbsqyJ4XfswFj4So7vlOISJQyaAiAtB1QRasWMjSmzgeYWG7RVdIOol/acXifVQvhaS9al+Q=="}],"size":11106,"noattachment":false,"key":"/escaper/-/escaper-3.0.3.tgz"},"maintainers":[{"name":"kobezzza","email":"kobezzza@mail.ru"}],"_npmUser":{"name":"kobezzza","email":"kobezzza@mail.ru"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escaper_3.0.3_1564072723153_0.48066190310771506"},"_hasShrinkwrap":false,"readme":"Escaper\n=======\n\nEscaper is a small JavaScript library to replace string literals, regular expressions, and comments from the JavaScript syntax.\n\n[Russian documentation](https://github.com/kobezzza/Escaper/blob/master/README.ru.md)\n\n[![NPM version](http://img.shields.io/npm/v/escaper.svg?style=flat)](http://badge.fury.io/js/escaper)\n[![NPM devDependencies](http://img.shields.io/david/dev/kobezzza/Escaper.svg?style=flat)](https://david-dm.org/kobezzza/Escaper?type=dev)\n[![Build Status](https://github.com/kobezzza/Escaper/workflows/build/badge.svg?branch=master)](https://github.com/kobezzza/Escaper/actions?query=workflow%3Abuild)\n[![Coverage Status](http://img.shields.io/coveralls/kobezzza/Escaper.svg?style=flat)](https://coveralls.io/r/kobezzza/Escaper?branch=master)\n\n**Supports:**\n\n* `' ... '`\n* `\" ... \"`\n* `` ` ... ` ``, `` ` ... ${...} ` ``\n* `/ ... /`\n* `// ...`, `//* ...`, `//! ...`, `//# ...`, `//@ ...`, `//$ ...`\n* `/* ... */`, `/** ... */`, `/*! ... */`, `/*# ... */`, `/*@ ... */`, `/*$ ... */`\n\n## Install\n\nhttps://raw.githubusercontent.com/kobezzza/Escaper/master/dist/escaper.min.js\n\nor\n\n```bash\nnpm install escaper\n```\n\nor\n\n```bash\nbower install escaper\n```\n\nor\n\n```bash\ngit clone https://github.com/kobezzza/Escaper\n```\n\n## Usage\n\n```js\nconst\n  str = 'Hello \"world\" and \\'friends\\'',\n  content = [];\n\n// Replaces all found matches\n// 'Hello __ESCAPER_QUOT__0_ and __ESCAPER_QUOT__1_'\nEscaper.replace(str, content)\n\n// Replaces only single quotes\n// 'Hello \"world\" and __ESCAPER_QUOT__0_'\nEscaper.replace(str, [\"'\"])\n\n// Cuts all found matches\n// 'Hello and '\nEscaper.replace(str, -1)\n\n// Replaces all and cuts single quotes\n// 'Hello __ESCAPER_QUOT__0_ and '\nEscaper.replace(str, {\"'\": -1})\n\n// Replaces all but strings\n// 'Hello __ESCAPER_QUOT__0_ and \\'friends\\''\nEscaper.replace(str, {strings: false})\n\n// Replaces all, but strings can be only single quotes\n// 'Hello \"world\" and __ESCAPER_QUOT__0_'\nEscaper.replace(str, {strings: [\"'\"]})\n\n// Replaces all, but strings can be only single quotes and it will be cut\n// 'Hello \"world\" and '\nEscaper.replace(str, {strings: {\"'\": -1}})\n\n// Replaces all found escape blocks to a real content\n// 'Hello \"world\" and \\'friends\\''\nEscaper.paste(str, content);\n```\n\n## API\n### Escaper.replace(str, how?, store?): string\n\nReplaces all found blocks `' ... '`, `\" ... \"`, `` ` ... ` ``, `/ ... /`, `// ...`, `/* ... */` to\nescape blocks from the specified string and returns a new string.\n\n**Arguments**\n\n* `string` `str` — source string;\n* `string[] | Record<string, string[] | Record<string, boolean | -1> | false | -1> | false | -1` `how?` —  parameters:\n\n**Possible values**\n\nIf a value is set to `-1`, then all found matches will be removed from the final string.\nIf the value is set to `boolean` it will be replaced/passed.\n\n```js\n// Label of replacement, by default __ESCAPER_QUOT__${pos}_\n'label'\n\n// Singleline comment\n'singleComments'\n\n// Multiline comments\n'multComments'\n\n// All kinds of comments\n'comments'\n\n// All kinds of strings\n'strings'\n\n// All kinds of literals (except strings and comments)\n'literals'\n\n// Literals\n\"'\"\n'\"'\n'`'\n'/'\n'//'\n'//*'\n'//!'\n'//#'\n'//@'\n'//$'\n'/*'\n'/**'\n'/*!'\n'/*#'\n'/*@'\n'/*$'\n```\n\nThe parameters can be specified as an array (escapes only explicitly specified sequences)\nor like an object (disables/excludes by a literal or group). Also, if you set the parameter value as `-1`,\nthen all found sequences will be removed from the string.\n\n* `string[]` `store = Escaper.content` — store for matches.\n\n### Escaper.paste(str, store?, rgxp?): string\n\nReplaces all found escape blocks to real content from the specified string and returns a new string.\n\n**Arguments**\n\n* `string` `str` — source string;\n* `string[]` `store = Escaper.content` — store of matches;\n* `RegExp` `rgxp?` — RegExp to search, e.g. `/__ESCAPER_QUOT__(\\d+)_/g`.\n\n## [License](https://github.com/kobezzza/Escaper/blob/master/LICENSE)\n\nThe MIT License.\n","publish_time":1564072723254,"_cnpm_publish_time":1564072723254,"dist-tags":{"latest":"3.0.6"}}