mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
Merge pull request #33564 from nwtgck/cheerio-buffer-load
[cheerio] Allow user to use Buffer in load()
This commit is contained in:
@@ -24,6 +24,8 @@ if ($fromElement("ul > li").length !== 3) {
|
||||
throw new Error("Expecting 3 elements when passing `CheerioElement` to `load()`");
|
||||
}
|
||||
|
||||
$ = cheerio.load(Buffer.from(html));
|
||||
|
||||
$ = cheerio.load(html, {
|
||||
normalizeWhitespace: true,
|
||||
xmlMode: true
|
||||
|
||||
Vendored
+4
-2
@@ -1,8 +1,10 @@
|
||||
// Type definitions for Cheerio v0.22.0
|
||||
// Project: https://github.com/cheeriojs/cheerio
|
||||
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>, AzSiAz <https://github.com/AzSiAz>
|
||||
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>, AzSiAz <https://github.com/AzSiAz>, Ryo Ota <https://github.com/nwtgck>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
interface Cheerio {
|
||||
// Document References
|
||||
// Cheerio https://github.com/cheeriojs/cheerio
|
||||
@@ -266,7 +268,7 @@ interface CheerioElement {
|
||||
}
|
||||
|
||||
interface CheerioAPI extends CheerioSelector, CheerioStatic {
|
||||
load(html: string, options?: CheerioOptionsInterface): CheerioStatic;
|
||||
load(html: string | Buffer, options?: CheerioOptionsInterface): CheerioStatic;
|
||||
load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user