{"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","jsnext:main":"src/escaper.js","typings":"escaper.d.ts","version":"3.0.0","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"},"keywords":["javascript","string"],"devDependencies":{"@types/gulp":"^4.0.5","@types/gulp-load-plugins":"0.0.31","babel-core":"^6.26.3","babel-plugin-transform-remove-strict-mode":"0.0.2","babel-preset-es2015-rollup":"^3.0.0","bower":"^1.8.4","closurecompiler-externs":"^1.0.4","coveralls":"^3.0.2","eslint":"^5.7.0","glob":"^7.1.3","gulp":"^4.0.0","gulp-bump":"^3.1.1","gulp-closure-compiler":"^0.4.0","gulp-download":"0.0.1","gulp-eol":"^0.2.0","gulp-header":"^2.0.5","gulp-ignore":"^2.0.2","gulp-istanbul":"^1.1.3","gulp-jasmine":"^3.0.0","gulp-load-plugins":"^1.5.0","gulp-monic":"^2.0.13","gulp-plumber":"^1.2.0","gulp-replace":"^1.0.0","gulp-rollup":"^2.16.2","gulp-run":"^1.6.8","gulp-wrap":"^0.14.0","jasmine":"^2.9.0","monic":"^2.5.1","rollup-plugin-babel":"^3.0.7","yaspeller":"^5.0.1"},"scripts":{"test":"bower install && jasmine","test-coverage":"bower install && gulp test","full-test":"npm run test-coverage && yaspeller ./"},"gitHead":"ecf4c5e6fcb93f6a97b78940cea3e9b31a8e0527","_id":"escaper@3.0.0","_npmVersion":"6.1.0","_nodeVersion":"10.9.0","_npmUser":{"name":"kobezzza","email":"kobezzza@mail.ru"},"dist":{"integrity":"sha512-ITyZdK7ZSCAYuFrXjp2apj0Z4b2U4Y1fXMLbbA8XN7r6frp5vu66QNSGlCz4ME85e7qBBXSHUorBiZmFm7+a0Q==","shasum":"ce5321fc5456cfa13ab4f6b0b64326ab438f58db","tarball":"http://registry-npm.ywwl.com/escaper/download/escaper-3.0.0.tgz","fileCount":13,"unpackedSize":38804,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb1eLwCRA9TVsSAnZWagAA5fQP/jGHUDJrU2efdsfzgY/C\nVF8me0Vce/f1nERRbpccOI0W89P2i73nyaT3m49iObH9MJwqRHiGas9CjQJ+\nHX8jl/s+dLzqnxxquP8iX9Jxq2gOpZFw7cHoasVXzxnzkVhjBu+abwn66q70\nsmKxuO5rL1cOhKKLX5CmWYDifOFZpCkO19sXa9NDt6Phz92tAzGX5dLduZEU\neF6S+rF9cR1fyVE4iRJz6+YHEU88zt0m55fNOjD8X6v9sLV9ZouC7QIjlW+x\n0uSMTaQZmcdEUAYaciwFyZ34+tNh55sMvfJ1yehio8k13OLreDfyO4iXp+vn\nMpODr/So6ZaUvMrxM3s1hfnUqYpt5CCnyNYfPctn9xJ6sUYbZWIxexQo38dz\nL9/59zZo+S58JRea5pKK6XUrIlbhhbFvqcm5hRr/L9c/ahiItMephM8pRnKP\nLmHhEC5yZ8j+mTePef2irmzZYneBKWe+LISRP1dQJDCAwvMoTgZggtxZn8e7\nlgWs+cczatCAEc0/OtBjEuIAzgTRZTfMfy0/zTWZq0FGlok8sO6exPK6ApYw\n/lzt+MU4NnsNMpZyDEXkW35Z6QezuvwFglwDXnc1C9233O3O0U4A7r+fOlAK\nZmRORYaY/Pw5rMDs0UTfuut7A7ml5EdT5g4EZSo90D+8zYXl474g++8YwgeE\nDUV0\r\n=v1+E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDB0MxUfy3co5v53clhU/jHQvO7+6zOnX6DxWoOmI81mwIgdjTfXaSuOLSaooZmXHu6jn1NEernDITIdiqcAZRZlFo="}],"size":10789,"noattachment":false,"key":"/escaper/-/escaper-3.0.0.tgz"},"maintainers":[{"name":"kobezzza","email":"kobezzza@mail.ru"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escaper_3.0.0_1540743920314_0.7292635336612399"},"_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":1540743920437,"_cnpm_publish_time":1540743920437,"dist-tags":{"latest":"3.0.6"}}