UNPKG

eslint-plugin-conarti-fsd

Version:
19 lines (14 loc) 464 B
const addSlashToStart = (targetPath) => targetPath ? `/${targetPath}` : ''; module.exports.convertToPublicApi = (pathsInfo) => { const { normalizedImportPath, isSameSlice, segmentFiles, segment, } = pathsInfo; const valueToRemove = isSameSlice ? segmentFiles : `${segment}${addSlashToStart(segmentFiles)}`; const publicApiPath = normalizedImportPath.replace(`/${valueToRemove}`, ''); return [publicApiPath, valueToRemove]; };