Comparing version 1.2.3 to 2.0.0
{ | ||
"name": "classwrap", | ||
"description": "0.3 KB JavaScript utility for conditionally concatenating class names.", | ||
"version": "1.2.3", | ||
"main": "dist/classwrap.js", | ||
"jsnext:main": "src/index.js", | ||
"module": "src/index.js", | ||
"typings": "classwrap.d.ts", | ||
"license": "MIT", | ||
"repository": "JorgeBucaran/classwrap", | ||
"files": [ | ||
"src", | ||
"dist", | ||
"classwrap.d.ts" | ||
], | ||
"author": "Jorge Bucaran", | ||
"keywords": [ | ||
"css", | ||
"jsx", | ||
"string", | ||
"classname" | ||
], | ||
"version": "2.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "jest --coverage --no-cache && tsc -p tests/ts", | ||
"build": "npm run bundle && npm run minify", | ||
"bundle": "rollup -i src/index.js -o dist/classwrap.js -m -f umd -n classwrap", | ||
"minify": "uglifyjs dist/classwrap.js -o dist/classwrap.js --mangle --compress warnings=false --pure-funcs=Object.defineProperty -p relative --source-map dist/classwrap.js.map", | ||
"bench": "node bench", | ||
"prepare": "npm run build", | ||
"format": "prettier --semi false --write 'src/**/*.js' '{,tests/ts/}*.ts'", | ||
"release": "npm run build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push origin master && git push --tags && npm publish" | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"babel": { | ||
"presets": "env" | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/npm/deprecate-holder.git" | ||
}, | ||
"devDependencies": { | ||
"babel-preset-env": "^1.6.1", | ||
"jest": "^21.2.1", | ||
"prettier": "~1.7.4", | ||
"rollup": "^0.50.0", | ||
"typescript": "^2.5.3", | ||
"uglify-js": "^2.7.5" | ||
} | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/npm/deprecate-holder/issues" | ||
}, | ||
"homepage": "https://github.com/npm/deprecate-holder#readme", | ||
"dependencies": {} | ||
} |
107
README.md
@@ -1,106 +0,5 @@ | ||
# Classwrap | ||
[![Travis CI](https://img.shields.io/travis/JorgeBucaran/classwrap/master.svg)](https://travis-ci.org/JorgeBucaran/classwrap) | ||
[![Codecov](https://img.shields.io/codecov/c/github/JorgeBucaran/classwrap/master.svg)](https://codecov.io/gh/JorgeBucaran/classwrap) | ||
[![npm](https://img.shields.io/npm/v/classwrap.svg)](https://www.npmjs.org/package/classwrap) | ||
# Deprecated Package | ||
Classwrap is a 0.3 KB JavaScript utility for conditionally concatenating [class names](https://developer.mozilla.org/en-US/docs/Web/API/Element/className). | ||
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name. | ||
[Try it Online](https://codepen.io/JorgeBucaran/pen/GMRjRB) | ||
```js | ||
import cw from "classwrap" | ||
export function ToggleButton({ toggle, isOn }) { | ||
return ( | ||
<div class="btn" onclick={toggle}> | ||
<div | ||
class={cw({ | ||
circle: true, | ||
off: !isOn, | ||
on: isOn | ||
})} | ||
/> | ||
<span | ||
class={cw({ | ||
textOff: !isOn | ||
})} | ||
> | ||
{isOn ? "ON" : "OFF"} | ||
</span> | ||
</div> | ||
) | ||
} | ||
``` | ||
Classwrap works in all browsers >=IE9. Use it with your favorite JavaScript view library. | ||
[![Classwrap](https://user-images.githubusercontent.com/56996/30416101-cda83bd4-9965-11e7-9db5-230ba3fc83fd.gif)](https://codepen.io/JorgeBucaran/full/GMRjRB/) | ||
## Installation | ||
Install with npm / Yarn. | ||
<pre> | ||
npm i <a href="https://www.npmjs.com/package/classwrap">classwrap</a> | ||
</pre> | ||
Then with a module bundler like [Rollup](https://github.com/rollup/rollup) or [Webpack](https://github.com/webpack/webpack), use as you would anything else. | ||
```js | ||
import cw from "classwrap" | ||
``` | ||
Or download the minified library from a [unpkg](https://unpkg.com/classwrap@latest/dist/classwrap.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/classwrap@latest/dist/classwrap.js). | ||
```html | ||
<script src="https://unpkg.com/classwrap"></script> | ||
``` | ||
Then find it on `window.classwrap`. | ||
## Usage | ||
Classwrap joins all elements of an array or keys of an object into a string. If the value associated with a given key is falsy, the key will be ignored. | ||
```js | ||
cw([ | ||
"btn", | ||
{ | ||
"btn-active": true, | ||
"btn-large": false | ||
} | ||
]) // => btn btn-active | ||
``` | ||
Nested arrays or objects are supported too. Use this feature to assemble classes with a common prefix. | ||
```js | ||
cw([ | ||
"tab", | ||
{ | ||
tab: { | ||
"--success": true, | ||
"--error": false, | ||
"--pending": false | ||
} | ||
} | ||
]) // => tab tab--success | ||
``` | ||
## Credits | ||
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 | ||
cw("foo", "bar", "baz") // => foo | ||
``` | ||
To solve this, wrap the arguments inside an array. | ||
```js | ||
cw(["foo", "bar", "baz"]) // => foo bar baz | ||
``` | ||
## License | ||
Classwrap is MIT licensed. See [LICENSE](LICENSE.md). | ||
Please contact support@npmjs.com if you have questions about this 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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
0
694
2
0
6
2