eslint-plugin-conarti-fsd
Version:
Feature-sliced design methodology plugin
19 lines (14 loc) • 390 B
JavaScript
const { joinPath } = require('./join-path');
const { isPathRelative } = require('./is-path-relative');
module.exports.convertToAbsolute = (fromPath, targetPath) => {
if (targetPath === '') {
return fromPath;
}
if (fromPath === '') {
return targetPath;
}
if (!isPathRelative(targetPath)) {
return targetPath;
}
return joinPath(fromPath, `../${targetPath}`);
};