Package Exports
- string-extract-class-names
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string-extract-class-names) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
string-extract-class-names
Extract classes (or id's) from a string into an array
Examples
// second param is omitted, falls back to default "."
extract('div.class-name.second-class-name a[target=_blank]')
// => ['.class-name', '.second-class-name']
// you can extract id and class combos:
extract('div#id.class a[target=_blank]', '#')
// => ['#id', '.class']
Install
$ npm install --save string-extract-class-names
Use
var extract = require('string-extract-class-names')
Test
$ npm test
Uses AVA for unit tests.
API
extract(
string // String. Input.
)
// => Extracted classes/id's in an array
Contributing & testing
All contributions welcome. This library uses Standard JavaScript notation. See test.js
. It's very minimalistic testing setup using AVA.
npm test
If you see anything incorrect whatsoever, raise an issue. PR's are welcome — fork, hack and PR.
Licence
MIT © Roy Reveltas