{"name":"striptags","description":"PHP's strip_tags in Javascript","license":"MIT","author":{"name":"Eric Norris","url":"https://github.com/ericnorris"},"repository":{"type":"git","url":"https://github.com/ericnorris/striptags.git"},"homepage":"https://github.com/ericnorris/striptags","bugs":{"url":"https://github.com/ericnorris/striptags/issues"},"version":"4.0.0-alpha.0","keywords":["striptags","strip_tags","html","strip","tags"],"main":"dist/cjs/striptags.js","module":"dist/es6/striptags.js","types":"dist/es6/striptags.d.ts","devDependencies":{"@rollup/plugin-typescript":"^6.1.0","@types/jest":"^26.0.15","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","eslint":"^7.14.0","eslint-plugin-prettier":"^3.1.4","jest":"^26.6.1","prettier":"^2.2.0","rollup":"^2.33.3","ts-jest":"^26.4.3","tslib":"^2.0.3","typescript":"^4.0.5"},"scripts":{"test":"jest","lint":"eslint .","prepublishOnly":"eslint . && rollup -c"},"readmeFilename":"README.md","readme":"# striptags (WIP)\n\nAn implementation of PHP's [strip_tags](https://www.php.net/manual/en/function.strip-tags.php) in Typescript.\n\n## Highlights\n\n- No dependencies\n- Prevents XSS by default\n\n## Installing\n\n```\nnpm install striptags\n```\n\n## Basic Usage\n\n```typescript\n// commonjs format\nstriptags(text: string, options?: Partial<StateMachineOptions>): string;\n```\n\n### Examples\n\n```javascript\n// commonjs format\nconst striptags = require(\"striptags\").striptags;\n\n// alternatively:\n// import { striptags } from \"striptags\";\n\nvar html = `\n<a href=\"https://example.com\">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>\n`.trim();\n\nconsole.log(striptags(html));\nconsole.log(striptags(html, {allowedTags: new Set([\"strong\"])}));\nconsole.log(striptags(html, {tagReplacementText: \"🍩\"}));\n```\n\nOutputs:\n\n```\nlorem ipsum dolor sit amet\nlorem ipsum <strong>dolor</strong> sit amet\n🍩lorem ipsum 🍩dolor🍩 🍩sit🍩 amet🍩\n```\n\n## Advanced Usage\n\n```typescript\nclass StateMachine {\n    constructor(partialOptions?: Partial<StateMachineOptions>);\n    consume(text: string): string;\n}\n```\n\nThe `StateMachine` class is similar to the `striptags` function, but persists state across calls to `consume()` so that you may safely pass in a stream of text. For example:\n\n```javascript\nconst StateMachine = require(\"striptags\").StateMachine;\n\n// alternatively:\n// import { StateMachine } from \"striptags\";\n\nconst instance = new StateMachine();\n\nconsole.log(\n  instance.consume(\"some text with <a\") + instance.consume(\"tag>and more text\")\n);\n```\n\nOutputs:\n\n```\nsome text with and more text\n```\n\n## Options\n\n* `allowedTags: Set<string>` a set containing a list of tag names to allow (e.g. `new Set([\"tagname\"])`), default: `new Set([])`.\n* `tagReplacementText: string` a string to use as replacement text when a tag is found and not allowed, default: `\"\"`.\n* `encodePlaintextTagDelimiters: boolean` true if `<` and `>` characters immediately followed by whitespace should be HTML encoded, default: `true`. This is safe to set to `false` if the output is expected to be used only as plaintext.\n","licenseText":"The MIT License (MIT)\n\nCopyright (c) [2020] [Eric Norris]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"striptags@4.0.0-alpha.0","dist":{"shasum":"c21a9eb5fec81b09b8e76a4f6ee168a04a1fe30b","integrity":"sha512-rbewxpe+S5ZTph40TZmfxFHJ3soxwU9PRG7lbl1jbe3Pa1IjkzFh6TLe+zqUL40aPxjseTdTiBtS5YUGaNLN+Q==","tarball":"http://registry-npm.ywwl.com/striptags/download/striptags-4.0.0-alpha.0.tgz","fileCount":11,"unpackedSize":17610,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfw9J7CRA9TVsSAnZWagAASSQP/iS4+V3sKiyq6j4uUkW5\nrvCHTl7KR1vGDgWZKL2BYOWl514flk8TXtEa0WMWea+aiJGDeTQeH1dlrydC\nRFTHzEuqbZroECNRpuoIuuXnpZrWwA+krBg3b44DwnAKg+q7ngUoxij741W6\ncUmLKm4a5D2C1rkYpmASmMVgtnvryPF9s8qAcBKIKcqDGPUiCJq98U66o9by\nnkyMejlelUsiyNXNGnh3Sh2OyviiK3k/UEvylzukXsrU03Bn2DnwCxdTpa2x\nZX6Oj2g/vm9PTJO39/GYpZ5Z5Vglsl5Ip6/FX6OUsMlhIS3DJOlU5+/J4A76\nlHLvZI0yPvCsDWJZKruYj2xxmVA+odnpd+z33sdCAZvMAhi8+aH6CH07uEC+\n8drg9wDB7sH+BDPKWrjf/p0eABedOSqD2RIsAjcPdkQvGPlZfE6HeOqmKefE\nR/ste3EXayjU9yAEzfm3d9iQslOtf7odDMdEjBPZTvqd2nrErQCK/Qq48wOF\nw1/1tf23dD3AbPZBTmrdgo+TCjMDBgiI3tB+i/A9WVG5/CFBqua2R/uHdJfl\nixYDxYYNHjESK20+rXxuvRhd7XkYTLpJ86d5VawdrH49C9Tf/LxgZn+LBw96\nr7mu0TnctZIE6RLuX3z3FIxzT1qsg2mDeE/kIkrbsBuHEwyn+h5aCivCPld6\nZza+\r\n=0eAV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHVo7+H+HHZ9meB/96+gajOM+2J2Sxk0uUXT7sFePdBnAiEA81RQB/DPFzS7oXSy5/fai4oH+cM/FmLiOEI3H5t+KRg="}],"size":3830,"noattachment":false,"key":"/striptags/-/striptags-4.0.0-alpha.0.tgz"},"_npmUser":{"name":"ericnorris","email":"erictnorris@gmail.com"},"directories":{},"maintainers":[{"name":"ericnorris","email":"erictnorris@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/striptags_4.0.0-alpha.0_1606668923560_0.5479770465853935"},"_hasShrinkwrap":false,"publish_time":1606668923697,"_cnpm_publish_time":1606668923697,"dist-tags":{"alpha":"4.0.0-alpha.4","latest":"3.2.0"}}