Socket
Socket
Sign inDemoInstall

@types/cheerio

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/cheerio - npm Package Compare versions

Comparing version 0.22.21 to 0.22.22

447

cheerio/index.d.ts

@@ -16,290 +16,293 @@ // Type definitions for Cheerio v0.22.0

declare type AttrFunction = (el: CheerioElement, i: number, currentValue: string) => any;
interface Document {}
interface Cheerio {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
// JQuery http://api.jquery.com
declare namespace cheerio {
interface Element {
// Document References
// Node Console
tagName: string;
type: string;
name: string;
attribs: { [attr: string]: string };
children: Element[];
childNodes: Element[];
lastChild: Element;
firstChild: Element;
next: Element;
nextSibling: Element;
prev: Element;
previousSibling: Element;
parent: Element;
parentNode: Element;
nodeValue: string;
data?: string;
startIndex?: number;
}
[index: number]: CheerioElement;
cheerio: string;
length: number;
type AttrFunction = (el: Element, i: number, currentValue: string) => any;
// Attributes
interface Cheerio {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
// JQuery http://api.jquery.com
attr(): { [attr: string]: string };
attr(name: string): string | undefined;
attr(name: string, value: AttrFunction): Cheerio;
// `value` *can* be `any` here but:
// 1. That makes type-checking the function-type useless
// 2. It's converted to a string anyways
attr(name: string, value: string): Cheerio;
// The map's values *can* be `any` but they'll all be cast to strings
// regardless.
attr(map: { [key: string]: any }): Cheerio;
[index: number]: Element;
cheerio: string;
length: number;
data(): any;
data(name: string): any;
data(name: string, value: any): any;
// Attributes
val(): string;
val(value: string): Cheerio;
attr(): { [attr: string]: string };
attr(name: string): string | undefined;
attr(name: string, value: AttrFunction): Cheerio;
// `value` *can* be `any` here but:
// 1. That makes type-checking the function-type useless
// 2. It's converted to a string anyways
attr(name: string, value: string): Cheerio;
// The map's values *can* be `any` but they'll all be cast to strings
// regardless.
attr(map: { [key: string]: any }): Cheerio;
removeAttr(name: string): Cheerio;
data(): any;
data(name: string): any;
data(name: string, value: any): any;
has(selector: string): Cheerio;
has(element: CheerioElement): Cheerio;
val(): string;
val(value: string): Cheerio;
hasClass(className: string): boolean;
addClass(classNames: string): Cheerio;
removeAttr(name: string): Cheerio;
removeClass(): Cheerio;
removeClass(className: string): Cheerio;
removeClass(func: (index: number, className: string) => string): Cheerio;
has(selector: string): Cheerio;
has(element: Element): Cheerio;
toggleClass(className: string): Cheerio;
toggleClass(className: string, toggleSwitch: boolean): Cheerio;
toggleClass(toggleSwitch?: boolean): Cheerio;
toggleClass(
func: (index: number, className: string, toggleSwitch: boolean) => string,
toggleSwitch?: boolean,
): Cheerio;
hasClass(className: string): boolean;
addClass(classNames: string): Cheerio;
is(selector: string): boolean;
is(element: CheerioElement): boolean;
is(element: CheerioElement[]): boolean;
is(selection: Cheerio): boolean;
is(func: (index: number, element: CheerioElement) => boolean): boolean;
removeClass(): Cheerio;
removeClass(className: string): Cheerio;
removeClass(func: (index: number, className: string) => string): Cheerio;
// Form
serialize(): string;
serializeArray(): { name: string; value: string }[];
toggleClass(className: string): Cheerio;
toggleClass(className: string, toggleSwitch: boolean): Cheerio;
toggleClass(toggleSwitch?: boolean): Cheerio;
toggleClass(
func: (index: number, className: string, toggleSwitch: boolean) => string,
toggleSwitch?: boolean,
): Cheerio;
// Traversing
is(selector: string): boolean;
is(element: Element): boolean;
is(element: Element[]): boolean;
is(selection: Cheerio): boolean;
is(func: (index: number, element: Element) => boolean): boolean;
find(selector: string): Cheerio;
find(element: Cheerio): Cheerio;
// Form
serialize(): string;
serializeArray(): { name: string; value: string }[];
parent(selector?: string): Cheerio;
parents(selector?: string): Cheerio;
parentsUntil(selector?: string, filter?: string): Cheerio;
parentsUntil(element: CheerioElement, filter?: string): Cheerio;
parentsUntil(element: Cheerio, filter?: string): Cheerio;
// Traversing
prop(name: string): any;
prop(name: string, value: any): Cheerio;
find(selector: string): Cheerio;
find(element: Cheerio): Cheerio;
closest(): Cheerio;
closest(selector: string): Cheerio;
parent(selector?: string): Cheerio;
parents(selector?: string): Cheerio;
parentsUntil(selector?: string, filter?: string): Cheerio;
parentsUntil(element: Element, filter?: string): Cheerio;
parentsUntil(element: Cheerio, filter?: string): Cheerio;
next(selector?: string): Cheerio;
nextAll(): Cheerio;
nextAll(selector: string): Cheerio;
prop(name: string): any;
prop(name: string, value: any): Cheerio;
nextUntil(selector?: string, filter?: string): Cheerio;
nextUntil(element: CheerioElement, filter?: string): Cheerio;
nextUntil(element: Cheerio, filter?: string): Cheerio;
closest(): Cheerio;
closest(selector: string): Cheerio;
prev(selector?: string): Cheerio;
prevAll(): Cheerio;
prevAll(selector: string): Cheerio;
next(selector?: string): Cheerio;
nextAll(): Cheerio;
nextAll(selector: string): Cheerio;
prevUntil(selector?: string, filter?: string): Cheerio;
prevUntil(element: CheerioElement, filter?: string): Cheerio;
prevUntil(element: Cheerio, filter?: string): Cheerio;
nextUntil(selector?: string, filter?: string): Cheerio;
nextUntil(element: Element, filter?: string): Cheerio;
nextUntil(element: Cheerio, filter?: string): Cheerio;
slice(start: number, end?: number): Cheerio;
prev(selector?: string): Cheerio;
prevAll(): Cheerio;
prevAll(selector: string): Cheerio;
siblings(selector?: string): Cheerio;
prevUntil(selector?: string, filter?: string): Cheerio;
prevUntil(element: Element, filter?: string): Cheerio;
prevUntil(element: Cheerio, filter?: string): Cheerio;
children(selector?: string): Cheerio;
slice(start: number, end?: number): Cheerio;
contents(): Cheerio;
siblings(selector?: string): Cheerio;
each(func: (index: number, element: CheerioElement) => any): Cheerio;
map(func: (index: number, element: CheerioElement) => any): Cheerio;
children(selector?: string): Cheerio;
filter(selector: string): Cheerio;
filter(selection: Cheerio): Cheerio;
filter(element: CheerioElement): Cheerio;
filter(elements: CheerioElement[]): Cheerio;
filter(func: (index: number, element: CheerioElement) => boolean): Cheerio;
contents(): Cheerio;
not(selector: string): Cheerio;
not(selection: Cheerio): Cheerio;
not(element: CheerioElement): Cheerio;
not(func: (index: number, element: CheerioElement) => boolean): Cheerio;
each(func: (index: number, element: Element) => any): Cheerio;
map(func: (index: number, element: Element) => any): Cheerio;
first(): Cheerio;
last(): Cheerio;
filter(selector: string): Cheerio;
filter(selection: Cheerio): Cheerio;
filter(element: Element): Cheerio;
filter(elements: Element[]): Cheerio;
filter(func: (index: number, element: Element) => boolean): Cheerio;
eq(index: number): Cheerio;
not(selector: string): Cheerio;
not(selection: Cheerio): Cheerio;
not(element: Element): Cheerio;
not(func: (index: number, element: Element) => boolean): Cheerio;
get(): any[];
get(index: number): any;
first(): Cheerio;
last(): Cheerio;
index(): number;
index(selector: string): number;
index(selection: Cheerio): number;
eq(index: number): Cheerio;
end(): Cheerio;
get(): any[];
get(index: number): any;
add(selectorOrHtml: string): Cheerio;
add(selector: string, context: Document): Cheerio;
add(element: CheerioElement): Cheerio;
add(elements: CheerioElement[]): Cheerio;
add(selection: Cheerio): Cheerio;
index(): number;
index(selector: string): number;
index(selection: Cheerio): number;
addBack(): Cheerio;
addBack(filter: string): Cheerio;
end(): Cheerio;
// Manipulation
appendTo(target: Cheerio): Cheerio;
prependTo(target: Cheerio): Cheerio;
add(selectorOrHtml: string): Cheerio;
add(selector: string, context: Document): Cheerio;
add(element: Element): Cheerio;
add(elements: Element[]): Cheerio;
add(selection: Cheerio): Cheerio;
append(content: string, ...contents: any[]): Cheerio;
append(content: Document, ...contents: any[]): Cheerio;
append(content: Document[], ...contents: any[]): Cheerio;
append(content: Cheerio, ...contents: any[]): Cheerio;
addBack(): Cheerio;
addBack(filter: string): Cheerio;
prepend(content: string, ...contents: any[]): Cheerio;
prepend(content: Document, ...contents: any[]): Cheerio;
prepend(content: Document[], ...contents: any[]): Cheerio;
prepend(content: Cheerio, ...contents: any[]): Cheerio;
// Manipulation
appendTo(target: Cheerio): Cheerio;
prependTo(target: Cheerio): Cheerio;
after(content: string, ...contents: any[]): Cheerio;
after(content: Document, ...contents: any[]): Cheerio;
after(content: Document[], ...contents: any[]): Cheerio;
after(content: Cheerio, ...contents: any[]): Cheerio;
append(content: string, ...contents: any[]): Cheerio;
append(content: Document, ...contents: any[]): Cheerio;
append(content: Document[], ...contents: any[]): Cheerio;
append(content: Cheerio, ...contents: any[]): Cheerio;
insertAfter(content: string): Cheerio;
insertAfter(content: Document): Cheerio;
insertAfter(content: Cheerio): Cheerio;
prepend(content: string, ...contents: any[]): Cheerio;
prepend(content: Document, ...contents: any[]): Cheerio;
prepend(content: Document[], ...contents: any[]): Cheerio;
prepend(content: Cheerio, ...contents: any[]): Cheerio;
before(content: string, ...contents: any[]): Cheerio;
before(content: Document, ...contents: any[]): Cheerio;
before(content: Document[], ...contents: any[]): Cheerio;
before(content: Cheerio, ...contents: any[]): Cheerio;
after(content: string, ...contents: any[]): Cheerio;
after(content: Document, ...contents: any[]): Cheerio;
after(content: Document[], ...contents: any[]): Cheerio;
after(content: Cheerio, ...contents: any[]): Cheerio;
insertBefore(content: string): Cheerio;
insertBefore(content: Document): Cheerio;
insertBefore(content: Cheerio): Cheerio;
insertAfter(content: string): Cheerio;
insertAfter(content: Document): Cheerio;
insertAfter(content: Cheerio): Cheerio;
remove(selector?: string): Cheerio;
before(content: string, ...contents: any[]): Cheerio;
before(content: Document, ...contents: any[]): Cheerio;
before(content: Document[], ...contents: any[]): Cheerio;
before(content: Cheerio, ...contents: any[]): Cheerio;
replaceWith(content: string): Cheerio;
replaceWith(content: CheerioElement): Cheerio;
replaceWith(content: CheerioElement[]): Cheerio;
replaceWith(content: Cheerio): Cheerio;
replaceWith(content: () => Cheerio): Cheerio;
insertBefore(content: string): Cheerio;
insertBefore(content: Document): Cheerio;
insertBefore(content: Cheerio): Cheerio;
empty(): Cheerio;
remove(selector?: string): Cheerio;
html(): string | null;
html(html: string): Cheerio;
replaceWith(content: string): Cheerio;
replaceWith(content: Element): Cheerio;
replaceWith(content: Element[]): Cheerio;
replaceWith(content: Cheerio): Cheerio;
replaceWith(content: () => Cheerio): Cheerio;
text(): string;
text(text: string): Cheerio;
empty(): Cheerio;
wrap(content: string): Cheerio;
wrap(content: Document): Cheerio;
wrap(content: Cheerio): Cheerio;
html(): string | null;
html(html: string): Cheerio;
css(propertyName: string): string;
css(propertyNames: string[]): string[];
css(propertyName: string, value: string): Cheerio;
css(propertyName: string, value: number): Cheerio;
css(propertyName: string, func: (index: number, value: string) => string): Cheerio;
css(propertyName: string, func: (index: number, value: string) => number): Cheerio;
css(properties: Object): Cheerio;
text(): string;
text(text: string): Cheerio;
// Rendering
wrap(content: string): Cheerio;
wrap(content: Document): Cheerio;
wrap(content: Cheerio): Cheerio;
// Miscellaneous
css(propertyName: string): string;
css(propertyNames: string[]): string[];
css(propertyName: string, value: string): Cheerio;
css(propertyName: string, value: number): Cheerio;
css(propertyName: string, func: (index: number, value: string) => string): Cheerio;
css(propertyName: string, func: (index: number, value: string) => number): Cheerio;
css(properties: Object): Cheerio;
clone(): Cheerio;
// Rendering
// Not Documented
// Miscellaneous
toArray(): CheerioElement[];
}
clone(): Cheerio;
interface CheerioOptionsInterface {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
// HTMLParser2 https://github.com/fb55/htmlparser2/wiki/Parser-options
// DomHandler https://github.com/fb55/DomHandler
// Not Documented
xmlMode?: boolean;
decodeEntities?: boolean;
lowerCaseTags?: boolean;
lowerCaseAttributeNames?: boolean;
recognizeCDATA?: boolean;
recognizeSelfClosing?: boolean;
normalizeWhitespace?: boolean;
withStartIndices?: boolean;
withEndIndices?: boolean;
ignoreWhitespace?: boolean;
_useHtmlParser2?: boolean;
}
toArray(): Element[];
}
interface CheerioSelector {
(selector: string): Cheerio;
(selector: string, context: string): Cheerio;
(selector: string, context: CheerioElement): Cheerio;
(selector: string, context: CheerioElement[]): Cheerio;
(selector: string, context: Cheerio): Cheerio;
(selector: string, context: string, root: string): Cheerio;
(selector: string, context: CheerioElement, root: string): Cheerio;
(selector: string, context: CheerioElement[], root: string): Cheerio;
(selector: string, context: Cheerio, root: string): Cheerio;
(selector: any): Cheerio;
}
interface CheerioParserOptions {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
// HTMLParser2 https://github.com/fb55/htmlparser2/wiki/Parser-options
// DomHandler https://github.com/fb55/DomHandler
interface CheerioStatic extends CheerioSelector {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
// JQuery http://api.jquery.com
root(): Cheerio;
contains(container: CheerioElement, contained: CheerioElement): boolean;
parseHTML(data: string, context?: Document, keepScripts?: boolean): Document[];
xmlMode?: boolean;
decodeEntities?: boolean;
lowerCaseTags?: boolean;
lowerCaseAttributeNames?: boolean;
recognizeCDATA?: boolean;
recognizeSelfClosing?: boolean;
normalizeWhitespace?: boolean;
withStartIndices?: boolean;
withEndIndices?: boolean;
ignoreWhitespace?: boolean;
_useHtmlParser2?: boolean;
}
html(options?: CheerioOptionsInterface): string;
html(dom: string | Cheerio | CheerioElement, options?: CheerioOptionsInterface): string;
interface Selector {
(selector: string): Cheerio;
(selector: string, context: string): Cheerio;
(selector: string, context: Element): Cheerio;
(selector: string, context: Element[]): Cheerio;
(selector: string, context: Cheerio): Cheerio;
(selector: string, context: string, root: string): Cheerio;
(selector: string, context: Element, root: string): Cheerio;
(selector: string, context: Element[], root: string): Cheerio;
(selector: string, context: Cheerio, root: string): Cheerio;
(selector: any): Cheerio;
}
xml(dom?: string | Cheerio | CheerioElement): string;
}
interface Root extends Selector {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
// JQuery http://api.jquery.com
root(): Cheerio;
contains(container: Element, contained: Element): boolean;
parseHTML(data: string, context?: Document, keepScripts?: boolean): Document[];
interface CheerioElement {
// Document References
// Node Console
tagName: string;
type: string;
name: string;
attribs: { [attr: string]: string };
children: CheerioElement[];
childNodes: CheerioElement[];
lastChild: CheerioElement;
firstChild: CheerioElement;
next: CheerioElement;
nextSibling: CheerioElement;
prev: CheerioElement;
previousSibling: CheerioElement;
parent: CheerioElement;
parentNode: CheerioElement;
nodeValue: string;
data?: string;
startIndex?: number;
}
html(options?: CheerioParserOptions): string;
html(dom: string | Cheerio | Element, options?: CheerioParserOptions): string;
interface CheerioAPI extends CheerioSelector, CheerioStatic {
load(html: string | Buffer, options?: CheerioOptionsInterface): CheerioStatic;
load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic;
xml(dom?: string | Cheerio | Element): string;
}
interface CheerioAPI extends Root {
version: string;
load(html: string | Buffer, options?: CheerioParserOptions): Root;
load(element: Element, options?: CheerioParserOptions): Root;
}
}
interface Document {}
declare module 'cheerio' {
const cheerio: CheerioAPI;
export = cheerio;
const cheerioModule: cheerio.CheerioAPI;
export = cheerioModule;
}
{
"name": "@types/cheerio",
"version": "0.22.21",
"version": "0.22.22",
"description": "TypeScript definitions for Cheerio",

@@ -63,4 +63,4 @@ "license": "MIT",

},
"typesPublisherContentHash": "f22b94ada923575fa41011be42d9f684c944f2a4fff47e6f192fc4d1d047123c",
"typeScriptVersion": "3.0"
"typesPublisherContentHash": "4f80eed4abe488886b4cd7112b5ea9654f1e496c2161a67e6cfcb5d2432bc881",
"typeScriptVersion": "3.2"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Wed, 08 Jul 2020 04:39:42 GMT
* Last updated: Wed, 23 Sep 2020 19:15:26 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)

@@ -14,0 +14,0 @@ * Global values: none

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc