| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; |
| 4 |
function isFatalError(settings, error) { |
| 5 |
if (settings.errorFilter === null) { |
| 6 |
return true; |
| 7 |
} |
| 8 |
return !settings.errorFilter(error); |
| 9 |
} |
| 10 |
exports.isFatalError = isFatalError; |
| 11 |
function isAppliedFilter(filter, value) { |
| 12 |
return filter === null || filter(value); |
| 13 |
} |
| 14 |
exports.isAppliedFilter = isAppliedFilter; |
| 15 |
function replacePathSegmentSeparator(filepath, separator) { |
| 16 |
return filepath.split(/[/\\]/).join(separator); |
| 17 |
} |
| 18 |
exports.replacePathSegmentSeparator = replacePathSegmentSeparator; |
| 19 |
function joinPathSegments(a, b, separator) { |
| 20 |
if (a === '') { |
| 21 |
return b; |
| 22 |
} |
| 23 |
/** |
| 24 |
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). |
| 25 |
*/ |
| 26 |
if (a.endsWith(separator)) { |
| 27 |
return a + b; |
| 28 |
} |
| 29 |
return a + separator + b; |
| 30 |
} |
| 31 |
exports.joinPathSegments = joinPathSegments; |