{"_quickTake.js":{"title":"Quick Take","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; extract &#x7D; from \"string-extract-class-names\";\n\n// extracts classes and/or id's\nconst str = \"div#brambles.nushes#croodles\";\nconst &#x7B; res, ranges &#x7D; = extract(str);\nassert.deepEqual(res, [\"#brambles\", \".nushes\", \"#croodles\"]);\nassert.deepEqual(ranges, [\n  [3, 12],\n  [12, 19],\n  [19, 28],\n]);\n\n// `res` can be produced by slicing `ranges`:\nassert.deepEqual(\n  res,\n  ranges.map(([from, to]) => str.slice(from, to))\n);"},"bracket-notation.js":{"title":"Supports legacy bracket notation emails used to use","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; extract &#x7D; from \"string-extract-class-names\";\n\n// Yahoo has changed many years ago so email template\n// must be really arcane to contain this notation\n// https://github.com/hteumeuleu/email-bugs/issues/49\n\nassert.deepEqual(extract(`td[id=\" abc-def \"]`), &#x7B;\n  res: [\"#abc-def\"],\n  ranges: [[8, 15]],\n&#x7D;);\n\n// notice the hash # is not covered by range indexes!"},"contrived-complex.js":{"title":"Non-parsing algorithm can tackle really dodgy CSS","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; extract &#x7D; from \"string-extract-class-names\";\n\n// probably invalid input, but works anyway:\nassert.deepEqual(extract(\"?#id1#id2? #id3#id4> p > #id5#id6\").res, [\n  \"#id1\",\n  \"#id2\",\n  \"#id3\",\n  \"#id4\",\n  \"#id5\",\n  \"#id6\",\n]);"},"with-space.js":{"title":"Processes whole CSS selectors","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; extract &#x7D; from \"string-extract-class-names\";\n\nassert.deepEqual(extract(\"div.first.second#third a[target=_blank]\").res, [\n  \".first\",\n  \".second\",\n  \"#third\",\n]);"}}