Comparing version 0.0.2 to 0.1.0
{ | ||
"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). |
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
6830
94