The CSS selector parser used for digger
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
.npmignore
.travis.yml
Makefile
README.md
package.json

README.md

digger-selector

Build status

The CSS selector parser used for digger

installation

$ npm install digger-selector

or in the browser using browserify

example

var Selector = require('digger-selector');

var parsed = Selector('product[price<=100] > caption.big, friend');

parsed would be this data structure:

{
    "string": "product[price<=100] > caption.big, friend",
    "phases": [
        [
            {
                "string": "product[price<=100]",
                "class": {},
                "attr": [
                    {
                        "field": "price",
                        "operator": "<=",
                        "value": "100"
                    }
                ],
                "modifier": {},
                "tag": "product"
            },
            {
                "string": " > caption.big",
                "class": {
                    "big": true
                },
                "attr": [],
                "modifier": {},
                "splitter": ">",
                "tag": "caption"
            }
        ],
        [
            {
                "string": "friend",
                "class": {},
                "attr": [],
                "modifier": {},
                "tag": "friend"
            }
        ]
    ]
}

licence

MIT