forked from sindresorhus/npm-keyword
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
81 lines (65 loc) · 1.93 KB
/
index.d.ts
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
declare namespace npmKeyword {
interface Options {
/**
Limits the amount of results.
@default 250
*/
readonly size?: number;
}
interface PackageDescriptor {
readonly name: string;
readonly description: string;
}
}
declare const npmKeyword: {
/**
Get a list of npm packages with a certain keyword.
@param keyword - One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']`.
@returns A list of packages having the specified keyword in their package.json `keyword` property.
@example
```
import npmKeyword = require('npm-keyword');
(async () => {
console.log(await npmKeyword('gulpplugin'));
//=> [{name: 'gulp-autoprefixer', description: '…'}, …]
})();
```
*/
(keyword: string | string[], options?: npmKeyword.Options): Promise<
npmKeyword.PackageDescriptor[]
>;
/**
Get a list of npm package names with a certain keyword.
@param keyword - One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']`.
@returns A list of package names. Use this if you don't need the description as it's faster.
@example
```
import npmKeyword = require('npm-keyword');
(async () => {
console.log(await npmKeyword.names('gulpplugin'));
//=> ['gulp-autoprefixer', …]
})();
```
*/
names(
keyword: string | string[],
options?: npmKeyword.Options
): Promise<string[]>;
/**
Get the count of npm packages names with a certain keyword.
@param keyword - One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']`.
@returns The count of packages.
@example
```
import npmKeyword = require('npm-keyword');
(async () => {
console.log(await npmKeyword.count('gulpplugin'));
//=> 3457
})();
```
*/
count(keyword: string | string[]): Promise<number>;
// TODO: Remove this for the next major release
default: typeof npmKeyword;
};
export = npmKeyword;