{"_id":"specificity","_rev":"105963","name":"specificity","description":"Calculate the specificity of a CSS selector","dist-tags":{"latest":"0.4.1"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"time":{"modified":"2021-06-03T10:38:17.000Z","created":"2012-08-20T10:00:11.122Z","0.4.1":"2018-08-28T10:36:37.773Z","0.4.0":"2018-07-17T11:35:37.501Z","0.3.2":"2017-09-26T02:08:47.748Z","0.3.1":"2017-06-30T06:35:02.912Z","0.3.0":"2016-10-05T22:55:37.891Z","0.2.1":"2016-06-20T11:54:26.851Z","0.2.0":"2016-06-19T04:04:03.287Z","0.1.6":"2016-06-19T03:56:47.075Z","0.1.5":"2016-01-06T20:46:56.810Z","0.1.4":"2014-04-14T22:24:20.283Z","0.1.3":"2012-09-23T10:35:38.626Z","0.1.2":"2012-09-02T11:05:39.738Z","0.1.1":"2012-08-20T10:10:54.138Z","0.1.0":"2012-08-20T10:00:11.122Z"},"users":{"monolithed":true,"ahmedelgabri":true,"markscripter":true},"author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"versions":{"0.4.1":{"name":"specificity","version":"0.4.1","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"dist/specificity","module":"dist/specificity.mjs","bin":{"specificity":"./bin/specificity"},"scripts":{"prepare":"rollup --config","test":"mocha test/test.js --require esm"},"devDependencies":{"esm":"^3.0.71","mocha":"^5.2.0","rollup":"^0.62.0"},"types":"specificity.d.ts","gitHead":"8757133ddd2ed0163f120900047ff0f92760b536","_id":"specificity@0.4.1","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"aab5e645012db08ba182e151165738d00887b019","size":8160,"noattachment":false,"key":"/specificity/-/specificity-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.4.1.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/specificity_0.4.1_1535452597383_0.4662544774410671"},"_hasShrinkwrap":false,"publish_time":1535452597773,"_cnpm_publish_time":1535452597773},"0.4.0":{"name":"specificity","version":"0.4.0","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"dist/specificity","module":"dist/specificity.mjs","bin":{"specificity":"./bin/specificity"},"scripts":{"prepare":"rollup --config","test":"mocha test/test.js --require esm"},"devDependencies":{"esm":"^3.0.71","mocha":"^5.2.0","rollup":"^0.62.0"},"types":"specificity.d.ts","gitHead":"b39fbff6f21e862eefaf63fde7b2abcd2e4ab5da","_id":"specificity@0.4.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"301b1ab5455987c37d6d94f8c956ef9d9fb48c1d","size":7885,"noattachment":false,"key":"/specificity/-/specificity-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.4.0.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/specificity_0.4.0_1531827337441_0.7529351083993481"},"_hasShrinkwrap":false,"publish_time":1531827337501,"_cnpm_publish_time":1531827337501},"0.3.2":{"name":"specificity","version":"0.3.2","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","bin":{"specificity":"./bin/specificity"},"scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"2.5.x"},"types":"specificity.d.ts","gitHead":"0d1890af82ef04b8de97b9b0f2c5fcd37a4075c3","_id":"specificity@0.3.2","_npmVersion":"5.4.1","_nodeVersion":"8.1.3","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"99e6511eceef0f8d9b57924937aac2cb13d13c42","size":5213,"noattachment":false,"key":"/specificity/-/specificity-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.3.2.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/specificity-0.3.2.tgz_1506391727206_0.5505353636108339"},"directories":{},"publish_time":1506391727748,"_hasShrinkwrap":false,"_cnpm_publish_time":1506391727748},"0.3.1":{"name":"specificity","version":"0.3.1","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","bin":{"specificity":"./bin/specificity"},"scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"2.5.x"},"gitHead":"4adcb91b6cbf452103451b36d2fe5d9d4e14bf7a","_id":"specificity@0.3.1","_shasum":"f1b068424ce317ae07478d95de3c21cf85e8d567","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"f1b068424ce317ae07478d95de3c21cf85e8d567","size":6733,"noattachment":false,"key":"/specificity/-/specificity-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.3.1.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/specificity-0.3.1.tgz_1498804502776_0.3063810260500759"},"directories":{},"publish_time":1498804502912,"_hasShrinkwrap":false,"_cnpm_publish_time":1498804502912},"0.3.0":{"name":"specificity","version":"0.3.0","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","bin":{"specificity":"./bin/specificity"},"scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"2.5.x"},"gitHead":"2ab18ea19c4c1a7d700d9f0183349331bb5ac6da","_id":"specificity@0.3.0","_shasum":"332472d4e5eb5af20821171933998a6bc3b1ce6f","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"332472d4e5eb5af20821171933998a6bc3b1ce6f","size":6653,"noattachment":false,"key":"/specificity/-/specificity-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.3.0.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/specificity-0.3.0.tgz_1475708134793_0.47068643709644675"},"directories":{},"publish_time":1475708137891,"_cnpm_publish_time":1475708137891,"_hasShrinkwrap":false},"0.2.1":{"name":"specificity","version":"0.2.1","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"2.5.x"},"gitHead":"a9e34ef4259fd55aea7076c543cbae8bb61de1e5","_id":"specificity@0.2.1","_shasum":"3a7047c2a179f35362e3990745cea539f15161b8","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"3a7047c2a179f35362e3990745cea539f15161b8","size":4858,"noattachment":false,"key":"/specificity/-/specificity-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.2.1.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/specificity-0.2.1.tgz_1466423666383_0.14964531338773668"},"directories":{},"publish_time":1466423666851,"_cnpm_publish_time":1466423666851,"_hasShrinkwrap":false},"0.2.0":{"name":"specificity","version":"0.2.0","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"2.5.x"},"gitHead":"c619b1561b12d50501e3ff38b8866a0afd1417e6","_id":"specificity@0.2.0","_shasum":"b6f0d3a07514031ae9794a4acf7456f7600228ad","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"b6f0d3a07514031ae9794a4acf7456f7600228ad","size":4686,"noattachment":false,"key":"/specificity/-/specificity-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.2.0.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/specificity-0.2.0.tgz_1466309042700_0.07252504304051399"},"directories":{},"publish_time":1466309043287,"_cnpm_publish_time":1466309043287,"_hasShrinkwrap":false},"0.1.6":{"name":"specificity","version":"0.1.6","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"2.5.x"},"gitHead":"78c316ed29e93b36f783b590f5178e5e2203027c","_id":"specificity@0.1.6","_shasum":"aa501048f96e69485ddc95ef9f7a5b77f01232aa","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"aa501048f96e69485ddc95ef9f7a5b77f01232aa","size":3847,"noattachment":false,"key":"/specificity/-/specificity-0.1.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.1.6.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/specificity-0.1.6.tgz_1466308606503_0.8948415596969426"},"directories":{},"publish_time":1466308607075,"_cnpm_publish_time":1466308607075,"_hasShrinkwrap":false},"0.1.5":{"name":"specificity","version":"0.1.5","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"git+https://github.com/keeganstreet/specificity.git"},"license":"MIT","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"1.11.x"},"gitHead":"6a86b924b3d7b6344f781e90c12af13526ec981c","_id":"specificity@0.1.5","_shasum":"fc7e1586341a82d40c3f4d4d89ef2c50a894abb5","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"dist":{"shasum":"fc7e1586341a82d40c3f4d4d89ef2c50a894abb5","size":3316,"noattachment":false,"key":"/specificity/-/specificity-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.1.5.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"publish_time":1452113216810,"_cnpm_publish_time":1452113216810,"_hasShrinkwrap":false},"0.1.4":{"name":"specificity","version":"0.1.4","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"https://github.com/keeganstreet/specificity.git"},"bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","engines":{"node":"~0.8.x"},"scripts":{"test":"mocha test/test.js"},"devDependencies":{"mocha":"1.11.x"},"_id":"specificity@0.1.4","dist":{"shasum":"d0bd347d7c7c43b77f5a48de4bb6a4e2c334eac4","size":3314,"noattachment":false,"key":"/specificity/-/specificity-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.1.4.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"keeganstreet","email":"keeganstreet@gmail.com"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"publish_time":1397514260283,"_cnpm_publish_time":1397514260283,"_hasShrinkwrap":false},"0.1.3":{"name":"specificity","version":"0.1.3","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"https://github.com/keeganstreet/specificity.git"},"bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","engines":{"node":"~0.8.x"},"scripts":{"test":"node_modules/.bin/mocha test/test.js"},"devDependencies":{"mocha":"1.3.x"},"_id":"specificity@0.1.3","dist":{"shasum":"0cbc9cc6486184aeff197d67526526f142c9aeb1","size":2818,"noattachment":false,"key":"/specificity/-/specificity-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.1.3.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"publish_time":1348396538626,"_cnpm_publish_time":1348396538626,"_hasShrinkwrap":false},"0.1.2":{"name":"specificity","version":"0.1.2","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"https://github.com/keeganstreet/specificity.git"},"bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","engines":{"node":"~0.8.x"},"scripts":{"test":"node_modules/.bin/mocha test/test.js"},"devDependencies":{"mocha":"1.3.x"},"_id":"specificity@0.1.2","dist":{"shasum":"79a6c10aab0c6325f0d8bed15831cdb6f3067940","size":2757,"noattachment":false,"key":"/specificity/-/specificity-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.1.2.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"publish_time":1346583939738,"_cnpm_publish_time":1346583939738,"_hasShrinkwrap":false},"0.1.1":{"name":"specificity","version":"0.1.1","description":"Calculate the specificity of a CSS selector","keywords":["CSS","specificity"],"homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"https://github.com/keeganstreet/specificity.git"},"bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","engines":{"node":"~0.8.x"},"scripts":{"test":"node_modules/.bin/mocha test/test.js"},"devDependencies":{"mocha":"1.3.x"},"_id":"specificity@0.1.1","dist":{"shasum":"3a4010933673b7973398abe9e683cac2ba7d000d","size":2639,"noattachment":false,"key":"/specificity/-/specificity-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.1.1.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"publish_time":1345457454138,"_cnpm_publish_time":1345457454138,"_hasShrinkwrap":false},"0.1.0":{"name":"specificity","version":"0.1.0","description":"Calculate the specificity of a CSS selector","keywords":"CSS, specificity","homepage":"https://github.com/keeganstreet/specificity","author":{"name":"Keegan Street","url":"http://keegan.st"},"repository":{"type":"git","url":"https://github.com/keeganstreet/specificity.git"},"bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"main":"specificity","engines":{"node":"~0.8.x"},"scripts":{"test":"node_modules/.bin/mocha test/test.js"},"devDependencies":{"mocha":"1.3.x"},"_id":"specificity@0.1.0","dist":{"shasum":"c9dd6812e260dcd8294e32ebea68ee184c01800a","size":2629,"noattachment":false,"key":"/specificity/-/specificity-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/specificity/download/specificity-0.1.0.tgz"},"maintainers":[{"name":"keeganstreet","email":"keeganstreet@gmail.com"}],"directories":{},"publish_time":1345456811122,"_cnpm_publish_time":1345456811122,"_hasShrinkwrap":false,"deprecated":"unsupported"}},"readme":"# Specificity Calculator\n\nA JavaScript module for calculating and comparing the [specificity of CSS selectors](https://www.w3.org/TR/selectors-3/#specificity). The module is used on the [Specificity Calculator](https://specificity.keegan.st/) website.\n\nSpecificity Calculator is built for CSS Selectors Level 3. Specificity Calculator isn’t a CSS validator. If you enter invalid selectors it will return incorrect results. For example, the [negation pseudo-class](https://www.w3.org/TR/selectors-3/#negation) may only take a simple selector as an argument. Using a psuedo-element or combinator as an argument for `:not()` is invalid CSS so Specificity Calculator will return incorrect results.\n\n## Supported runtime environments\n\nThe module is provided in two formats: an ECMAScript (ES) module in `dist/specificity.mjs`, and a Universal Module Definition (UMD) in `dist/specificity.js`. This enables support for the following runtime environments:\n\n**Browser**\n\n  * Directly loaded ES module\n  * ES module in a precompiled script (using a bundler like Webpack or Rollup)\n  * Global variable\n\n**Node.js**\n\n  * ES module\n  * CommonJS module\n\n### Browser usage as a directly loaded ES module\n\n```html\n<script type=\"module\">\n  import { calculate } from './specificity/dist/specificity.mjs';\n\n  calculate('ul#nav li.active a');\n</script>\n```\n\n### Browser usage as an ES module in a precompiled script\n\nBundlers like [Webpack and Rollup](https://github.com/rollup/rollup/wiki/pkg.module) import from the `module` field in `package.json`, which is set to the ES module artefact, `dist/specificity.mjs`.\n\n```js\nimport { calculate } from 'specificity';\n\ncalculate('ul#nav li.active a');\n```\n\n### Browser usage as a global variable\n\nThe UMD artefact, `dist/specificity.js`, sets a global variable, `SPECIFICITY`.\n\n```html\n<script src=\"./specificity/dist/specificity.js\"></script>\n\n<script>\n  SPECIFICITY.calculate('ul#nav li.active a');\n</script>\n```\n\n### Node.js usage as an ES module\n\nThe `main` field in `package.json` has an extensionless value, `dist/specificity`. This allows Node.js to use either the ES module, in `dist/specificity.mjs`, or the CommonJS module, in `dist/specificity.js`.\n\nWhen Node.js is run with the `--experimental-modules` [flag](https://nodejs.org/api/esm.html) or an [ES module loader](https://www.npmjs.com/package/esm), it will use the ES module artefact.\n\n```js\nimport { calculate } from 'specificity';\n\ncalculate('ul#nav li.active a');\n```\n\n### Node.js usage as a CommonJS module\n\nOtherwise, Node.js will use the UMD artefact, which contains a CommonJS module definition.\n\n```js\nconst { calculate } = require('specificity');\n\ncalculate('ul#nav li.active a');\n```\n\n## Calculate function\n\nThe `calculate` function returns an array containing a result object for each selector input. Each result object has the following properties:\n\n  * `selector`: the input\n  * `specificity`: the result as a string e.g. `0,1,0,0`\n  * `specificityArray`: the result as an array of numbers e.g. `[0, 1, 0, 0]`\n  * `parts`: array with details about each part of the selector that counts towards the specificity\n\n## Example\n\n```js\ncalculate('ul#nav li.active a');\n\n/*\n[\n  {\n    selector: 'ul#nav li.active a',\n    specificity: '0,1,1,3',\n    specificityArray: [0, 1, 1, 3],\n    parts: [\n      { selector: 'ul', type: 'c', index: 0, length: 2 },\n      { selector: '#nav', type: 'a', index: 2, length: 4 },\n      { selector: 'li', type: 'c', index: 5, length: 2 },\n      { selector: '.active', type: 'b', index: 8, length: 7 },\n      { selector: 'a', type: 'c', index: 13, length: 1 }\n    ]\n  }\n]\n*/\n```\n\nYou can use comma separation to pass in multiple selectors:\n\n```js\ncalculate('ul#nav li.active a, body.ie7 .col_3 h2 ~ h2');\n\n/*\n[\n  {\n    selector: 'ul#nav li.active a',\n    specificity: '0,1,1,3',\n    ...\n  },\n  {\n    selector: 'body.ie7 .col_3 h2 ~ h2',\n    specificity: '0,0,2,3',\n    ...\n  }\n]\n*/\n```\n\n## Comparing two selectors\n\nSpecificity Calculator also exports a `compare` function. This function accepts two CSS selectors or specificity arrays, `a` and `b`.\n\n  * It returns `-1` if `a` has a lower specificity than `b`\n  * It returns `1` if `a` has a higher specificity than `b`\n  * It returns `0` if `a` has the same specificity than `b`\n\n```js\ncompare('div', '.active');            // -1\ncompare('#main', 'div');              // 1\ncompare('span', 'div');               // 0\ncompare('span', [0, 0, 0, 1]);        // 0\ncompare('#main > div', [0, 1, 0, 1]); // 0\n```\n\n## Ordering an array of selectors by specificity\n\nYou can pass the `compare` function to `Array.prototype.sort` to sort an array of CSS selectors by specificity.\n\n```js\nimport { compare } from 'specificity';\n\n['#main', 'p', '.active'].sort(compare); // ['p', '.active', '#main']\n```\n\n## Command-line usage\n\nRun `npm install specificity` to install the module locally, or `npm install -g specificity` for global installation. Run `specificity` without arguments to learn about its usage:\n\n```bash\n$ specificity\nUsage: specificity <selector>\nComputes specificity of a CSS selector.\n```\n\nPass a selector as the first argument to get its specificity computed:\n\n```bash\n$ specificity \"ul#nav li.active a\"\n0,1,1,3\n```\n\n## Testing\n\nTo install dependencies, run: `npm install`\n\nThen to test, run: `npm test`\n","_attachments":{},"homepage":"https://github.com/keeganstreet/specificity","bugs":{"url":"https://github.com/keeganstreet/specificity/issues"},"license":"MIT"}