Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

classnames

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.5 to 2.2.6

3

bind.js
/*!
Copyright (c) 2016 Jed Watson.
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see

@@ -39,2 +39,3 @@ http://jedwatson.github.io/classnames

if (typeof module !== 'undefined' && module.exports) {
classNames.default = classNames;
module.exports = classNames;

@@ -41,0 +42,0 @@ } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {

/*!
Copyright (c) 2016 Jed Watson.
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see

@@ -100,2 +100,3 @@ http://jedwatson.github.io/classnames

if (typeof module !== 'undefined' && module.exports) {
classNames.default = classNames;
module.exports = classNames;

@@ -102,0 +103,0 @@ } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {

# Changelog
## v2.2.6 / 2018-06-08
* Fixed compatibility issue with usage in an es module environment
## v2.2.5 / 2016-05-02

@@ -4,0 +8,0 @@

/*!
Copyright (c) 2016 Jed Watson.
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see

@@ -24,4 +24,7 @@ http://jedwatson.github.io/classnames

classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (Array.isArray(arg) && arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
} else if (argType === 'object') {

@@ -40,2 +43,3 @@ for (var key in arg) {

if (typeof module !== 'undefined' && module.exports) {
classNames.default = classNames;
module.exports = classNames;

@@ -42,0 +46,0 @@ } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {

{
"name": "classnames",
"version": "2.2.5",
"version": "2.2.6",
"description": "A simple utility for conditionally joining classNames together",

@@ -14,4 +14,5 @@ "main": "index.js",

"benchmarks": "node ./benchmarks/run",
"unit": "mocha tests/*.js",
"test": "npm run unit"
"benchmarks-browserify": "./node_modules/.bin/browserify ./benchmarks/runInBrowser.js >./benchmarks/runInBrowser.bundle.js",
"benchmarks-in-browser": "./node_modules/.bin/opn ./benchmarks/benchmarks.html",
"test": "mocha tests/*.js"
},

@@ -29,4 +30,6 @@ "keywords": [

"benchmark": "^1.0.0",
"mocha": "^2.1.0"
"browserify": "^14.1.0",
"mocha": "^2.1.0",
"opn-cli": "^3.1.0"
}
}

@@ -6,13 +6,25 @@ Classnames

[![Build Status](https://travis-ci.org/JedWatson/classnames.svg?branch=master)](https://travis-ci.org/JedWatson/classnames)
[![Supported by Thinkmill](https://thinkmill.github.io/badge/heart.svg)](http://thinkmill.com.au/?utm_source=github&utm_medium=badge&utm_campaign=classnames)
A simple javascript utility for conditionally joining classNames together.
A simple JavaScript utility for conditionally joining classNames together.
Install with npm or Bower.
Install with [npm](https://www.npmjs.com/), [Bower](https://bower.io/), or [Yarn](https://yarnpkg.com/):
npm:
```sh
npm install classnames
npm install classnames --save
```
Use with node.js, browserify or webpack:
Bower:
```sh
bower install classnames --save
```
Yarn (note that `yarn add` automatically saves the package to the `dependencies` in `package.json`):
```sh
yarn add classnames
```
Use with [Node.js](https://nodejs.org/en/), [Browserify](http://browserify.org/), or [webpack](https://webpack.github.io/):
```js

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

The `classNames` function takes any number of arguments which can be a string or object.
The argument `'foo'` is short for `{ foo: true }`. If the value of the key is falsy, it won't be included in the output.
The argument `'foo'` is short for `{ foo: true }`. If the value associated with a given key is falsy, that key won't be included in the output.

@@ -74,3 +86,3 @@ ```js

One of its primary use cases is to make dynamic and conditional className props simpler to work with (especially more so than conditional string manipulation). So where you may have the following code to generate a `className` prop for a `<button>` in React:
One of its primary use cases is to make dynamic and conditional `className` props simpler to work with (especially more so than conditional string manipulation). So where you may have the following code to generate a `className` prop for a `<button>` in React:

@@ -98,3 +110,3 @@ ```js

var btnClass = classNames({
'btn': true,
btn: true,
'btn-pressed': this.state.isPressed,

@@ -108,3 +120,3 @@ 'btn-over': !this.state.isPressed && this.state.isHovered

Because you can mix together object, array and string arguments, supporting optional className props is also simpler as only truthy arguments get included in the result:
Because you can mix together object, array and string arguments, supporting optional `className` props is also simpler as only truthy arguments get included in the result:

@@ -125,3 +137,3 @@ ```js

To use the dedupe version with node, browserify or webpack:
To use the dedupe version with Node.js, Browserify, or webpack:

@@ -194,2 +206,2 @@ ```js

[MIT](LICENSE). Copyright (c) 2016 Jed Watson.
[MIT](LICENSE). Copyright (c) 2017 Jed Watson.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc