Skip to content

Commit c70ceb2

Browse files
committed
Added gently
1 parent 78d1707 commit c70ceb2

File tree

2 files changed

+116
-1
lines changed

2 files changed

+116
-1
lines changed

cheerio.d.ts

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
module "cheerio" {
2+
export import cheerio = module("cheerio");
3+
4+
function load(body: string, opts?: CheerioOpt) : CheerioObj;
5+
function (selector: string, body: string): CheerioObj;
6+
function (selector: string, context: string, root: string): CheerioObj;
7+
8+
interface CheerioOpt {
9+
ignoreWhitespace: bool;
10+
xmlMode: bool;
11+
lowerCaseTags: bool;
12+
}
13+
14+
interface CheerioObj {
15+
// Selectors
16+
(selector: string, context?: string, root?: string): CheerioSelector;
17+
(selector: string, context?: CheerioObj, root?: string): CheerioSelector;
18+
(selector: CheerioObj, context?: string, root?: string): CheerioSelector;
19+
(selector: CheerioObj, context?: CheerioObj, root?: string): CheerioSelector;
20+
21+
// Rendering
22+
html(selector?: string): string;
23+
24+
// Utilities
25+
root(): CheerioSelector;
26+
dom(): any;
27+
isArray(obj: any): bool;
28+
inArray(elem: any, array: any[]): number;
29+
makeArray(obj: any): any[];
30+
each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any;
31+
merge(first: any[], second: any[]): any[];
32+
}
33+
34+
interface CheerioSelector {
35+
// Array functions
36+
length: number;
37+
[x: string]: HTMLElement;
38+
[x: number]: HTMLElement;
39+
40+
// Attributes
41+
attr(attributeName: string, value: any): CheerioSelector;
42+
attr(map: { [key: any]: any; }): CheerioSelector;
43+
attr(attributeName: string, func: (index: any, attr: any) => any): CheerioSelector;
44+
45+
removeAttr(attributeName: any): CheerioSelector;
46+
47+
hasClass(className: string): bool;
48+
49+
addClass(classNames: string): CheerioSelector;
50+
addClass(func: (index: any, currentClass: any) => CheerioSelector);
51+
52+
removeClass(className?: any): CheerioSelector;
53+
removeClass(func: (index: any, cls: any) => any): CheerioSelector;
54+
55+
// Traversing
56+
find(selector: string): CheerioSelector;
57+
find(element: any): CheerioSelector;
58+
find(obj: CheerioSelector): CheerioSelector;
59+
60+
parent(selector?: string): CheerioSelector;
61+
62+
next(selector?: string): CheerioSelector;
63+
64+
prev(selector?: string): CheerioSelector;
65+
66+
siblings(selector?: string): CheerioSelector;
67+
68+
children(selector?: any): CheerioSelector;
69+
70+
each(func: (index: any, elem: Element) => CheerioSelector);
71+
72+
map(callback: (index: any, domElement: Element) =>any): CheerioSelector;
73+
74+
filter(selector: string): CheerioSelector;
75+
filter(func: (index: any) =>any): CheerioSelector;
76+
filter(element: any): CheerioSelector;
77+
filter(obj: CheerioSelector): CheerioSelector;
78+
79+
first(): CheerioSelector;
80+
81+
last(): CheerioSelector;
82+
83+
eq(index: number): CheerioSelector;
84+
85+
// Manipulation
86+
append(...content: any[]): CheerioSelector;
87+
append(func: (index: any, html: any) => any);
88+
89+
prepend(...content: any[]): CheerioSelector;
90+
prepend(func: (index: any, html: any) =>any): CheerioSelector;
91+
92+
after(...content: any[]): CheerioSelector;
93+
after(func: (index: any) => any);
94+
95+
before(...content: any[]): CheerioSelector;
96+
before(func: (index: any) => any);
97+
98+
remove(selector?: any): CheerioSelector;
99+
100+
replaceWith(content: any): CheerioSelector;
101+
102+
empty(): CheerioSelector;
103+
104+
html(htmlString: string): CheerioSelector;
105+
html(): string;
106+
107+
text(textString: string): CheerioSelector;
108+
text(): string;
109+
110+
// Miscellaneous
111+
toArray(): any[];
112+
113+
clone(): CheerioSelector;
114+
}
115+
}

nock.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare module "nock" {
1+
module "nock" {
22
export import nock = module('nock');
33

44
function(host: string, options?: Options): Scope;

0 commit comments

Comments
 (0)