classnames
Advanced tools
Comparing version 1.1.0 to 1.1.1
13
index.js
function classNames() { | ||
var args = arguments, classes = []; | ||
var args = arguments; | ||
var classes = []; | ||
for (var i = 0; i < args.length; i++) { | ||
@@ -12,5 +14,8 @@ var arg = args[i]; | ||
} else if ('object' === typeof arg) { | ||
classes = classes.concat(Object.keys(arg).filter(function(cls) { | ||
return arg[cls]; | ||
})); | ||
for (var key in arg) { | ||
if (!arg.hasOwnProperty(key) || !arg[key]) { | ||
continue; | ||
} | ||
classes.push(key); | ||
} | ||
} | ||
@@ -17,0 +22,0 @@ } |
{ | ||
"name": "classnames", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A simple utility for conditionally joining classNames together", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,4 +16,4 @@ var assert = require("assert"); | ||
it('joins arrays of class names and ignore falsy values', function() { | ||
assert.equal(classNames('a', 0, null, undefined, 'b'), 'a b'); | ||
it('joins arrays of class names and ignore non-string values', function() { | ||
assert.equal(classNames('a', 0, null, undefined, true, 1, 'b'), 'a b'); | ||
}); | ||
@@ -20,0 +20,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4455
45