/
index.d.ts
55 lines (45 loc) · 1.28 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
declare namespace findUp {
interface Options {
/**
Directory to start from.
@default process.cwd()
*/
readonly cwd?: string;
}
}
declare const findUp: {
/**
Find a file or directory by walking up parent directories.
@param filename - Filename of the file or an array of files to find.
@returns Either the first filepath found (by respecting the order of `filename`s) or `null`.
@example
```
// /
// └── Users
// └── sindresorhus
// ├── unicorn.png
// └── foo
// └── bar
// ├── baz
// └── example.js
// example.js
import findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
})();
```
*/
(filename: string | string[], options?: findUp.Options): Promise<
string | null
>;
/**
Synchronously find a file or directory by walking up parent directories.
@param filename - Filename of the file or an array of files to find.
@returns Either the first filepath found (by respecting the order of `filename`s) or `null`.
*/
sync(filename: string | string[], options?: findUp.Options): string | null;
};
export = findUp;