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

classwrap

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classwrap - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

2

package.json
{
"name": "classwrap",
"description": "320B JavaScript function for conditionally concatenating classNames.",
"version": "0.0.2",
"version": "0.1.0",
"main": "dist/classwrap.js",

@@ -6,0 +6,0 @@ "jsnext:main": "src/index.js",

@@ -8,8 +8,6 @@ # Classwrap

## Hello World
[Try it Online](https://codepen.io/jbucaran/pen/GMRjRB)
```js
function HelloButton(props) {
function HelloButton({ active, label }) {
const name = classwrap([

@@ -19,9 +17,12 @@ "btn",

{
"btn-pressed": props.isPressed
"btn-active": active
}
])
return <button class={name}>{props.label}</button>
return <button class={name}>{label}</button>
}
```
Classwrap works in >=IE9 and you can use it with your favorite JavaScript view library.
## Installation

@@ -80,6 +81,16 @@

Classwrap was inspired by [JedWatson/classnames](https://github.com/JedWatson/classnames) with support for nested objects and [improved](/bench/README.md) performance.
Classwrap was inspired by [JedWatson/classnames](https://github.com/JedWatson/classnames) with support for nested objects and [improved](/bench/README.md) performance. It differs from classnames in that it does not accept [variable arguments](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments).
```js
classwrap("foo", "bar", "baz") // => foo
```
To solve this wrap the arguments inside an array.
```js
classwrap(["foo", "bar", "baz"]) // => foo bar baz
```
## License
Classwrap is MIT licensed. See [LICENSE](LICENSE.md).
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