New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ramumb/strip-tags

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ramumb/strip-tags

Strips a string of any HTML tags.

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

strip-tags(function)

Build Status Coverage Status

This is a port of the PrototypeJS method stripTags. It strips a string of any HTML 4.01 tags — like div, span, and abbr. It will not, however, strip namespace-prefixed tags such as h:table or xsl:template. Nor will it remove any content from within <script> tags. Lastly, while stripTags is good enough for most purposes, it shouldn't be relied upon for security purposes. If processing end-user supplied content, stripTags is not sufficiently robust enough to ensure that the content is completely devoid of HTML tags in the case of an end-user who's intentionally trying to circumvent a tag restriction.

Installation

npm install @ramumb/strip-tags

Usage

var stripTags = require('strip-tags');

stripTags('a <a href="#">link</a>');
// -> 'a link'

stripTags('a <a href="#">link</a><script>alert("hello world!");</script>');
// -> 'a linkalert("hello world!");'

stripTags('<xsl:template match="/"><html><body><h2>My CD Collection</h2><xsl:apply-templates/></body></html></xsl:template>');
// -> '<xsl:template match="/">My CD Collection<xsl:apply-templates/></xsl:template>'

Tests

npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code. See the CONTRIBUTING file for more detailed information.

Keywords

striptags

FAQs

Package last updated on 18 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts