1151
// path.resolve([from ...], to)
1152
resolve(...pathSegments: string[]): string {
1153
>
let resolvedPath = '';
path.ts
1154
>
let resolvedAbsolute = false;
1155
>
1156
>
for (let i = pathSegments.length - 1; i >= 0 && !resolvedAbsolute; i--) {
1157
>
const path = pathSegments[i];
1158
>
validateString(path, `paths[${i}]`);
1159
>
1160
>
// Skip empty entries
1161
>
if (path.length === 0) {
1162
continue;
1163
}
1165
>
resolvedPath = `${path}/${resolvedPath}`;
1166
>
resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
1167
>
}
1168
>
1169
>
if (!resolvedAbsolute) {
1170
const cwd = posixCwd();
1171
resolvedPath = `${cwd}/${resolvedPath}`;