1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.normalizeSeparators = normalizeSeparators;
|
7 | exports.normalizePath = normalizePath;
|
8 | exports.relativePath = relativePath;
|
9 |
|
10 | var _path = _interopRequireDefault(require("path"));
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 | const SEPARATOR_REGEX = /[\\]+/g;
|
15 |
|
16 | function normalizeSeparators(filePath) {
|
17 | return filePath.replace(SEPARATOR_REGEX, '/');
|
18 | }
|
19 |
|
20 | function normalizePath(filePath, leadingDotSlash = true) {
|
21 | if (leadingDotSlash && filePath[0] !== '.' && filePath[0] !== '/') {
|
22 | return normalizeSeparators('./' + filePath);
|
23 | } else {
|
24 | return normalizeSeparators(filePath);
|
25 | }
|
26 | }
|
27 |
|
28 | function relativePath(from, to, leadingDotSlash = true) {
|
29 | return normalizePath(_path.default.relative(from, to), leadingDotSlash);
|
30 | } |
\ | No newline at end of file |