🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

strip-attributes

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strip-attributes

Strip attributes from HTML tags.

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
429
51.06%
Maintainers
2
Weekly downloads
 
Created
Source

strip-attributes NPM version NPM monthly downloads NPM total downloads Linux Build Status

Strip attributes from HTML tags.

Install

Install with npm:

$ npm install --save strip-attributes

Usage

Pass a string of HTML to stripAttr():

var stripAttr = require('strip-attributes');
var str = '<h1 id="a" class="b">Foo</h1>';

// By default, all attributes are omitted
stripAttr(str);
//=> '<h1>Foo</h1>'

Omit specific attributes

Pass an array of specific attributes to omit to options.omit:

stripAttr(str, {omit: ['class']});
//=> '<h1 id="a" >Foo</h1>'

Keep specific attributes

Pass an array of specific attributes to keep to options.keep:

stripAttr(str, {keep: ['class']});
//=> '<h1 class="b">Foo</h1>'

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT license.

This file was generated by verb-generate-readme, v0.2.3, on January 04, 2017.

Keywords

attributes

FAQs

Package last updated on 04 Jan 2017

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