Socket
Socket
Sign inDemoInstall

css-select-codsen-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    css-select-codsen-parser

An adapter for `css-select` to allow querying of `codsen-parser` generated trees.


Version published
Weekly downloads
18
increased by800%
Maintainers
1
Install size
18.5 kB
Created
Weekly downloads
 

Readme

Source

css-select-codsen-parser

An adapter for css-select to allow querying of codsen-parser generated trees.

Install

$ npm install css-select-codsen-parser

Usage

To use this adapter, first you must run the AST through prepare.

const parse = require("codsen-parser");
const CSSselect = require("css-select");
const { prepare, adapter } = require("css-select-codsen-parser");

const ast = prepare(
  parse(`
    <div id="greeting">
      Hello <span class="name">Alice</span>
    </div>
  `)
);

const nodes = cssSelect("#greeting .name", ast, { adapter });
// => [ { type: 'tag', start: 37, end: 56, value: '<span class="name">'... ]

API

prepare(ast)

Note: This method modifies the AST directly.

Accepts an AST generated by codsen-parser.

Returns the same AST.

adapter

css-select adapter. See documentation on how to use a custom adapter.

FAQs

Last updated on 07 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc