source: trip-planner-front/node_modules/canonical-path/index.d.ts@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.5 KB
Line 
1declare module 'canonical-path' {
2 /**
3 * A parsed path object generated by path.parse() or consumed by path.format().
4 */
5 interface ParsedPath {
6 /**
7 * The root of the path such as '/' or 'c:\'
8 */
9 root: string;
10 /**
11 * The full directory path such as '/home/user/dir' or 'c:\path\dir'
12 */
13 dir: string;
14 /**
15 * The file name including extension (if any) such as 'index.html'
16 */
17 base: string;
18 /**
19 * The file extension (if any) such as '.html'
20 */
21 ext: string;
22 /**
23 * The file name without extension (if any) such as 'index'
24 */
25 name: string;
26 }
27 interface FormatInputPathObject {
28 /**
29 * The root of the path such as '/' or 'c:\'
30 */
31 root?: string;
32 /**
33 * The full directory path such as '/home/user/dir' or 'c:\path\dir'
34 */
35 dir?: string;
36 /**
37 * The file name including extension (if any) such as 'index.html'
38 */
39 base?: string;
40 /**
41 * The file extension (if any) such as '.html'
42 */
43 ext?: string;
44 /**
45 * The file name without extension (if any) such as 'index'
46 */
47 name?: string;
48 }
49
50 /**
51 * Normalize a string path, reducing '..' and '.' parts.
52 * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
53 *
54 * @param p string path to normalize.
55 */
56 function normalize(p: string): string;
57 /**
58 * Join all arguments together and normalize the resulting path.
59 * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
60 *
61 * @param paths paths to join.
62 */
63 function join(...paths: string[]): string;
64 /**
65 * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
66 *
67 * Starting from leftmost {from} paramter, resolves {to} to an absolute path.
68 *
69 * If {to} isn't already absolute, {from} arguments are prepended in right to left order,
70 * until an absolute path is found. If after using all {from} paths still no absolute path is found,
71 * the current working directory is used as well. The resulting path is normalized,
72 * and trailing slashes are removed unless the path gets resolved to the root directory.
73 *
74 * @param pathSegments string paths to join. Non-string arguments are ignored.
75 */
76 function resolve(...pathSegments: string[]): string;
77 /**
78 * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
79 *
80 * @param path path to test.
81 */
82 function isAbsolute(path: string): boolean;
83 /**
84 * Solve the relative path from {from} to {to}.
85 * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
86 */
87 function relative(from: string, to: string): string;
88 /**
89 * Return the directory name of a path. Similar to the Unix dirname command.
90 *
91 * @param p the path to evaluate.
92 */
93 function dirname(p: string): string;
94 /**
95 * Return the last portion of a path. Similar to the Unix basename command.
96 * Often used to extract the file name from a fully qualified path.
97 *
98 * @param p the path to evaluate.
99 * @param ext optionally, an extension to remove from the result.
100 */
101 function basename(p: string, ext?: string): string;
102 /**
103 * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
104 * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
105 *
106 * @param p the path to evaluate.
107 */
108 function extname(p: string): string;
109 /**
110 * The platform-specific file separator. '\\' or '/'.
111 */
112 const sep: '\\' | '/';
113 /**
114 * The platform-specific file delimiter. ';' or ':'.
115 */
116 const delimiter: ';' | ':';
117 /**
118 * Returns an object from a path string - the opposite of format().
119 *
120 * @param pathString path to evaluate.
121 */
122 function parse(pathString: string): ParsedPath;
123 /**
124 * Returns a path string from an object - the opposite of parse().
125 *
126 * @param pathString path to evaluate.
127 */
128 function format(pathObject: FormatInputPathObject): string;
129
130 /**
131 * Returns the canonical form of a path.
132 * @param p the path to make canonical.
133 */
134 function canonical(p: string): string;
135}
Note: See TracBrowser for help on using the repository browser.