{"_id":"react-classset","_rev":"3144084","name":"react-classset","description":"Utility for easily manipulating the DOM class string","dist-tags":{"latest":"0.0.2"},"maintainers":[{"name":"chenglou","email":"chenglou92@gmail.com"},{"name":"floydophone","email":"floydophone@gmail.com"}],"time":{"modified":"2023-11-27T06:58:05.000Z","created":"2013-12-08T02:14:52.346Z","0.0.2":"2015-01-31T14:07:16.052Z","0.0.1":"2013-12-08T02:14:52.346Z"},"users":{},"author":{"name":"Pete Hunt"},"repository":{"type":"git","url":"https://github.com/petehunt/react-classset"},"versions":{"0.0.2":{"name":"react-classset","version":"0.0.2","description":"Utility for easily manipulating the DOM class string","main":"classSet.js","scripts":{"test":"mocha tests.js"},"repository":{"type":"git","url":"https://github.com/petehunt/react-classset"},"keywords":["react","addon","classSet","cx","class","style"],"author":{"name":"Pete Hunt"},"license":"Apache 2","devDependencies":{"mocha":"^2.1.0"},"gitHead":"67361b77ff8d9169cb19d3e4631da1f3918be4e2","bugs":{"url":"https://github.com/petehunt/react-classset/issues"},"homepage":"https://github.com/petehunt/react-classset","_id":"react-classset@0.0.2","_shasum":"adc62798acba8c0b2290506c190ea092a59c1f53","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"chenglou","email":"chenglou92@gmail.com"},"maintainers":[{"name":"chenglou","email":"chenglou92@gmail.com"},{"name":"floydophone","email":"floydophone@gmail.com"}],"dist":{"shasum":"adc62798acba8c0b2290506c190ea092a59c1f53","size":1956,"noattachment":false,"key":"/react-classset/-/react-classset-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-classset/download/react-classset-0.0.2.tgz"},"directories":{},"publish_time":1422713236052,"_hasShrinkwrap":false,"_cnpm_publish_time":1422713236052,"_cnpmcore_publish_time":"2021-12-16T18:02:28.740Z"},"0.0.1":{"name":"react-classset","version":"0.0.1","description":"classSet() from React.addons","main":"classSet.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"."},"keywords":["react","classSet","cx"],"author":{"name":"Pete Hunt"},"license":"Apache 2","readmeFilename":"README.md","_id":"react-classset@0.0.1","dist":{"shasum":"74501414d04bd8c13b7db02968e7b6f35e95afb0","size":1905,"noattachment":false,"key":"/react-classset/-/react-classset-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-classset/download/react-classset-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"floydophone","email":"floydophone@gmail.com"},"maintainers":[{"name":"chenglou","email":"chenglou92@gmail.com"},{"name":"floydophone","email":"floydophone@gmail.com"}],"directories":{},"publish_time":1386468892346,"_hasShrinkwrap":false,"_cnpm_publish_time":1386468892346,"_cnpmcore_publish_time":"2021-12-16T18:02:28.935Z"}},"readme":"# react-classset\n\n`classSet()` is a neat utility for easily manipulating the DOM `class` string. This previously resided inside [React](https://github.com/facebook/react) as a utility, but is now pulled out and library-agnostic.\n\nHere's a common scenario\n\n```javascript\nvar classString = 'message';\nif (isImportant) {\n  classString += ' message-important';\n}\nif (isRead) {\n  classString += ' message-read';\n}\n```\n\nThis can quickly get tedious, as assigning class name strings can be hard to read and error-prone. `classSet()` solves this problem:\n\n```javascript\nvar classString = classSet({\n  'message': true,\n  'message-important': isImportant,\n  'message-read': isRead\n});\n```\n\nWhen using `classSet()`, pass an object with keys of the CSS class names you might or might not need. Truthy values will result in the key being a part of the resulting string.\n\nAlternatively, you can also use it this way:\n\n```javascript\ncx('a', 0, null, undefined, 'b'); // 'a 0 b', discards null values\n```\n\nNo more hacky string concatenations!\n","_attachments":{},"homepage":"https://github.com/petehunt/react-classset","bugs":{"url":"https://github.com/petehunt/react-classset/issues"},"license":"Apache 2"}