Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

posthtml-rename-attrs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthtml-rename-attrs - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

3

package.json
{
"name": "posthtml-rename-attrs",
"version": "2.0.0",
"version": "2.0.1",
"description": "Rename HTML tags",

@@ -9,2 +9,3 @@ "keywords": [

"devDependencies": {
"camelcase": "^4.1.0",
"chai": "^4.1.2",

@@ -11,0 +12,0 @@ "mocha": "^4.0.1",

@@ -13,5 +13,3 @@ # posthtml-rename-attrs

posthtml([ require('posthtml-rename-attrs')({
'.wow' : prefix
})])
posthtml([ require('posthtml-rename-attrs')(prefix)])
.process(html)

@@ -18,0 +16,0 @@ .then(function(result) {

@@ -1,15 +0,16 @@

var posthtml = require('posthtml'),
const posthtml = require('posthtml'),
camelcase = require('camelcase'),
expect = require('chai').expect,
renameTags = require('..');
const prefix = v => v === 'class' ? `prefix-${v}` : v;
const camelize = name => camelcase(name);
describe('Plugin', function() {
it('should process simple class selectors', function() {
var html = '<div class="wow">OMG</div>';
it('should process', function() {
var html = '<div prefix-class="wow">OMG</div>';
return pluginProcess(prefix, html)
return pluginProcess(camelize, html)
.then(function(html) {
expect(html).to.eql('<div prefix-class="wow">OMG</div>');
expect(html).to.eql('<div prefixClass="wow">OMG</div>');
});

@@ -19,3 +20,3 @@ });

it('should process tag selectors and skip empty attrs', function () {
it('should skip empty attrs', function () {
var html = '<div>OMG</div><p>block</p><div>OMG2</div>',

@@ -25,3 +26,3 @@ expectedHtml = '<div>OMG</div><p>block</p>' +

return pluginProcess(prefix, html)
return pluginProcess(camelize, html)
.then(function(html) {

@@ -31,13 +32,2 @@ expect(html).to.eql(expectedHtml);

});
it('should process other match helper and skip non class attrs', function () {
var html = '<div id="id">OMG</div><p id="wow">block</p><div>OMG2</div>',
expectedHtml = '<div id="id">OMG</div><p id="wow">block</p>' +
'<div>OMG2</div>';
return pluginProcess(prefix, html)
.then(function(html) {
expect(html).to.eql(expectedHtml);
});
});
});

@@ -44,0 +34,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc