UNPKG

3.17 kBTypeScriptView Raw
1/// <reference types="node" />
2/**
3 * The main types of Cheerio objects.
4 *
5 * @category Cheerio
6 */
7export type { Cheerio } from './cheerio.js';
8/**
9 * Types used in signatures of Cheerio methods.
10 *
11 * @category Cheerio
12 */
13export * from './types.js';
14export type { CheerioOptions, HTMLParser2Options, Parse5Options, } from './options.js';
15/**
16 * Re-exporting all of the node types.
17 *
18 * @category DOM Node
19 */
20export type { Node, AnyNode, ParentNode, Element, Document } from 'domhandler';
21export type { CheerioAPI } from './load.js';
22/**
23 * Create a querying function, bound to a document created from the provided markup.
24 *
25 * Note that similar to web browser contexts, this operation may introduce
26 * `<html>`, `<head>`, and `<body>` elements; set `isDocument` to `false` to
27 * switch to fragment mode and disable this.
28 *
29 * @param content - Markup to be loaded.
30 * @param options - Options for the created instance.
31 * @param isDocument - Allows parser to be switched to fragment mode.
32 * @returns The loaded document.
33 * @see {@link https://cheerio.js.org#loading} for additional usage information.
34 */
35export declare const load: (content: string | import("domhandler").AnyNode | import("domhandler").AnyNode[] | Buffer, options?: import("./options.js").CheerioOptions | null | undefined, isDocument?: boolean) => import("./load.js").CheerioAPI;
36/**
37 * The default cheerio instance.
38 *
39 * @deprecated Use the function returned by `load` instead.
40 */
41declare const _default: import("./load.js").CheerioAPI;
42export default _default;
43export { html, xml, text } from './static.js';
44import * as staticMethods from './static.js';
45/**
46 * In order to promote consistency with the jQuery library, users are encouraged
47 * to instead use the static method of the same name.
48 *
49 * @deprecated
50 * @example
51 *
52 * ```js
53 * const $ = cheerio.load('<div><p></p></div>');
54 *
55 * $.contains($('div').get(0), $('p').get(0));
56 * //=> true
57 *
58 * $.contains($('p').get(0), $('div').get(0));
59 * //=> false
60 * ```
61 *
62 * @returns {boolean}
63 */
64export declare const contains: typeof staticMethods.contains;
65/**
66 * In order to promote consistency with the jQuery library, users are encouraged
67 * to instead use the static method of the same name.
68 *
69 * @deprecated
70 * @example
71 *
72 * ```js
73 * const $ = cheerio.load('');
74 *
75 * $.merge([1, 2], [3, 4]);
76 * //=> [1, 2, 3, 4]
77 * ```
78 */
79export declare const merge: typeof staticMethods.merge;
80/**
81 * In order to promote consistency with the jQuery library, users are encouraged
82 * to instead use the static method of the same name as it is defined on the
83 * "loaded" Cheerio factory function.
84 *
85 * @deprecated See {@link static/parseHTML}.
86 * @example
87 *
88 * ```js
89 * const $ = cheerio.load('');
90 * $.parseHTML('<b>markup</b>');
91 * ```
92 */
93export declare const parseHTML: typeof staticMethods.parseHTML;
94/**
95 * Users seeking to access the top-level element of a parsed document should
96 * instead use the `root` static method of a "loaded" Cheerio function.
97 *
98 * @deprecated
99 * @example
100 *
101 * ```js
102 * const $ = cheerio.load('');
103 * $.root();
104 * ```
105 */
106export declare const root: typeof staticMethods.root;
107//# sourceMappingURL=index.d.ts.map
\No newline at end of file