Gathering detailed insights and metrics for cheerio-select
Gathering detailed insights and metrics for cheerio-select
Gathering detailed insights and metrics for cheerio-select
Gathering detailed insights and metrics for cheerio-select
CSS selector engine supporting jQuery selectors, based on css-select
npm install cheerio-select
55
Supply Chain
73
Quality
75.5
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
19 Stars
861 Commits
8 Forks
5 Watching
5 Branches
5 Contributors
Updated on 26 Nov 2024
Minified
Minified + Gzipped
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
-2.9%
1,338,752
Compared to previous day
Last week
4.7%
7,263,498
Compared to previous week
Last month
11.1%
29,745,122
Compared to previous month
Last year
19.8%
307,797,677
Compared to previous year
cheerio-select
is a CSS selector engine that supports jQuery selectors, based
on the css-select
library. This library
is a thin wrapper around css-select
that
adds support for all of the jQuery positional pseudo-selectors:
:first
: Selects the first element in the set of elements.:last
: Selects the last element in the set of elements.:eq(index)
: Selects the element with the specified index.:nth(index)
: Selects the element with the specified index. This
pseudo-class is equivalent to :eq.:gt(index)
: Selects elements with a higher index than the specified value.:lt(index)
: Selects elements with a lower index than the specified value.:even
: Selects even elements, zero-indexed. For example, :even will select
the second, fourth, and sixth elements.:odd
: Selects odd elements, zero-indexed. For example, :odd will select
the first, third, and fifth elements.:not(:positional)
, where :positional
is any of the above: Excludes
elements that match the specified selector.To install cheerio-select, use npm:
1npm install cheerio-select
1import { parseDocument } from "htmlparser2"; 2import { select, filter, is, some } from "cheerio-select"; 3 4const document = parseDocument("<html><body><div></div></body></html>"); 5 6const dom = parseDocument("<div><p>First<p>Second"); 7 8// Select all divs 9expect(select("div", dom)).toHaveLength(1); 10 11// Accepts a function as a selector 12expect(select((elem) => elem.name === "p", dom)).toHaveLength(2); 13 14// Supports positionals 15expect(select("p:first", dom)).toHaveLength(1); 16 17// Supports filtering 18expect(filter("p:contains(First)", dom.children)).toHaveLength(1); 19 20// Supports checking whether an element matches a selector 21expect(is("p", dom.children[0])).toBe(true); 22 23// Supports checking whether any element in a list matches a selector 24expect(some("p", dom.children)).toBe(true);
Only use this module if you will actually use jQuery positional selectors in
your project. If you do not need these specific selectors, it is recommended to
use the css-select
library directly.
This project is licensed under the BSD-2-Clause license. See the LICENSE file for more info.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
SAST tool is run on all commits
Details
Reason
2 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More