source: imaps-frontend/node_modules/locate-path/index.d.ts

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.5 KB
Line 
1declare namespace locatePath {
2 interface Options {
3 /**
4 Current working directory.
5
6 @default process.cwd()
7 */
8 readonly cwd?: string;
9
10 /**
11 Type of path to match.
12
13 @default 'file'
14 */
15 readonly type?: 'file' | 'directory';
16
17 /**
18 Allow symbolic links to match if they point to the requested path type.
19
20 @default true
21 */
22 readonly allowSymlinks?: boolean;
23 }
24
25 interface AsyncOptions extends Options {
26 /**
27 Number of concurrently pending promises. Minimum: `1`.
28
29 @default Infinity
30 */
31 readonly concurrency?: number;
32
33 /**
34 Preserve `paths` order when searching.
35
36 Disable this to improve performance if you don't care about the order.
37
38 @default true
39 */
40 readonly preserveOrder?: boolean;
41 }
42}
43
44declare const locatePath: {
45 /**
46 Synchronously get the first path that exists on disk of multiple paths.
47
48 @param paths - Paths to check.
49 @returns The first path that exists or `undefined` if none exists.
50 */
51 sync: (
52 paths: Iterable<string>,
53 options?: locatePath.Options
54 ) => string | undefined;
55
56 /**
57 Get the first path that exists on disk of multiple paths.
58
59 @param paths - Paths to check.
60 @returns The first path that exists or `undefined` if none exists.
61
62 @example
63 ```
64 import locatePath = require('locate-path');
65
66 const files = [
67 'unicorn.png',
68 'rainbow.png', // Only this one actually exists on disk
69 'pony.png'
70 ];
71
72 (async () => {
73 console(await locatePath(files));
74 //=> 'rainbow'
75 })();
76 ```
77 */
78 (paths: Iterable<string>, options?: locatePath.AsyncOptions): Promise<
79 string | undefined
80 >;
81};
82
83export = locatePath;
Note: See TracBrowser for help on using the repository browser.