npm install parse-selA "parse selector" kind of utility function.
With npm do:
``bash`
npm install parse-sel --save
This module exports a function that takes a string with a hyperscript selector and returns an object.
`js
const parseSelector = require('parse-sel')
parseSelector('div#foo.bar')
// =>
// {
// tagName: 'div',
// id: 'foo',
// className: 'bar'
// }
`
You can pass true as a second argument and get the tagName` uppercase.
This is mainly lifted from the virtual-dom module.
https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/parse-tag.js
There's also quite a few packages like this on npm.
MIT