@yandex/ui
Version:
Yandex UI components
19 lines (14 loc) • 425 B
JavaScript
const path = require('path');
const isModulePath = (importPath) => {
return !/^(\.\/|\.\.\/)/.test(importPath) && !path.isAbsolute(importPath);
};
const normalizeImportPath = (filepath, importPath) => {
if (!isModulePath(importPath)) {
return path.relative(path.dirname(filepath), path.resolve(importPath));
}
return importPath;
};
module.exports = {
normalizeImportPath,
isModulePath,
};