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

class-prefixer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

class-prefixer - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

5

index.js

@@ -15,3 +15,3 @@ var classNames = require('classnames');

module.exports = function className(prefix) {
function cls(mainClass, stateClass) {
function cls(mainClass, stateClass, defaultPrefix) {
mainClass = mainClass || '';

@@ -23,3 +23,4 @@ stateClass = stateClass || '';

.map(function(c) {return prefix + '-' + c}).join(' ') + ' ' + stateClass;
return result.trim() || prefix;
result = result.trim() || prefix;
return (defaultPrefix && result !== prefix ) ? prefix + ' ' + result : result;
}

@@ -26,0 +27,0 @@ cls.add = function (name) {

2

package.json
{
"name": "class-prefixer",
"version": "0.1.1",
"version": "0.2.0",
"description": "clsssName prefixer",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -32,3 +32,9 @@ require('should');

cls('a').should.eql('pre-a');
})
});
it('defaultPrefix', function() {
var cls = className('pre');
cls('a', '', true).should.eql('pre pre-a');
cls('', '', true).should.eql('pre');
cls('', 'a', true).should.eql('pre a');
});
});
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