0.2.1 • Published 2 years ago

clear-style v0.2.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

clear-style

Clear the style attribute or other attributes in the HTML string.

Install

node.js:

npm install clear-style --save

Usage

import { clearStyle } from 'clear-style';

console.log(clearStyle('<span lang="EN-US" style="line-height: 125%;">100 kPa</span>'));
// => <span lang="EN-US">100 kPa</span>

or with commonjs

const { clearStyle } = require('clear-style');

console.log(clearStyle('<span lang="EN-US" style="line-height: 125%;">100 kPa</span>'));
// => <span lang="EN-US">100 kPa</span>

API

clearSyle

import { clearStyle } from 'clear-style';

console.log(clearStyle('<span lang="EN-US" style="line-height: 125%;">100 kPa</span>'));
// => <span lang="EN-US">100 kPa</span>

clearAllAtributes

import { clearAllAtributes } from 'clear-style';

console.log(clearAllAtributes('<span lang="EN-US" style="line-height: 125%;">100 kPa</span>'));
// => <span>100 kPa</span>

clearAtributes

import { clearAttributes } from 'clear-style';

console.log(clearAttributes('<span lang="EN-US" style="line-height: 125%;">100 kPa</span>', 'style', 'lang'));
// => <span>100 kPa</span>

clearAtribute

import { clearAttribute } from 'clear-style';

console.log(clearAttribute('<span lang="EN-US" style="line-height: 125%;">100 kPa</span>', (attribute) => attribute === 'lang'));
// => <span style="line-height: 125%;">100 kPa</span>
0.2.1

2 years ago

0.2.0

2 years ago