cheerio.d.ts
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { CheerioOptions, InternalOptions } from './options';
import type { Node, Document, Element } from 'domhandler';
import * as Static from './static';
import type { load } from './load';
import { SelectorType, BasicAcceptedElems } from './types';
import * as Attributes from './api/attributes';
import * as Traversing from './api/traversing';
import * as Manipulation from './api/manipulation';
import * as Css from './api/css';
import * as Forms from './api/forms';
declare type AttributesType = typeof Attributes;
declare type TraversingType = typeof Traversing;
declare type ManipulationType = typeof Manipulation;
declare type CssType = typeof Css;
declare type FormsType = typeof Forms;
export declare class Cheerio<T> implements ArrayLike<T> {
length: number;
[index: number]: T;
options: InternalOptions;
/**
* The root of the document. Can be overwritten by using the `root` argument
* of the constructor.
*
* @private
*/
_root: Cheerio<Document> | undefined;
/** @function */
find: typeof Traversing.find;
/**
* The root the document was originally loaded with. Same as the static
* `_root` property.
*
* @private
*/
_originalRoot: Document | undefined;
/**
* The root the document was originally loaded with. Set in `.load`.
*
* @private
*/
static _root: Document | undefined;
/**
* The options the document was originally loaded with. Set in `.load`.
*
* @private
*/
static _options: InternalOptions | undefined;
static html: typeof Static.html;
static xml: typeof Static.xml;
static text: typeof Static.text;
static parseHTML: typeof Static.parseHTML;
static root: typeof Static.root;
static contains: typeof Static.contains;
static merge: typeof Static.merge;
static load: typeof load;
/** Mimic jQuery's prototype alias for plugin authors. */
static fn: Cheerio<any>;
/**
* Instance of cheerio. Methods are specified in the modules. Usage of this
* constructor is not recommended. Please use $.load instead.
*
* @private
* @param selector - The new selection.
* @param context - Context of the selection.
* @param root - Sets the root node.
* @param options - Options for the instance.
*/
constructor(selector?: T extends Node ? BasicAcceptedElems<T> : Cheerio<T> | T[], context?: BasicAcceptedElems<Node> | null, root?: BasicAcceptedElems<Document>, options?: CheerioOptions);
prevObject: Cheerio<Node> | undefined;
/**
* Make a cheerio object.
*
* @private
* @param dom - The contents of the new object.
* @param context - The context of the new object.
* @returns The new cheerio object.
*/
_make<T>(dom: Cheerio<T> | T[] | T | string, context?: BasicAcceptedElems<Node> | null, root?: BasicAcceptedElems<Document> | undefined): Cheerio<T>;
/**
* Retrieve all the DOM elements contained in the jQuery set as an array.
*
* @example
*
* ```js
* $('li').toArray();
* //=> [ {...}, {...}, {...} ]
* ```
*
* @returns The contained items.
*/
toArray(): T[];
}
export interface Cheerio<T> extends AttributesType, TraversingType, ManipulationType, CssType, FormsType {
cheerio: '[cheerio object]';
splice: typeof Array.prototype.slice;
[Symbol.iterator](): Iterator<T>;
}
declare type CheerioClassType = typeof Cheerio;
/**
* Wrapper around the `Cheerio` class, making it possible to create a new
* instance without using `new`.
*/
export interface CheerioAPI extends CheerioClassType {
<T extends Node, S extends string>(selector?: S | BasicAcceptedElems<T>, context?: BasicAcceptedElems<Node> | null, root?: BasicAcceptedElems<Document>, options?: CheerioOptions): Cheerio<S extends SelectorType ? Element : T>;
}
declare const _default: CheerioAPI;
export default _default;
//# sourceMappingURL=cheerio.d.ts.map