relative-path.cjs 256 B

123456789
  1. const path = require('path').posix;
  2. module.exports = (base, p) => {
  3. const relativePath = path.relative(base, p);
  4. if (p.endsWith('/') && !relativePath.endsWith('/') && relativePath !== '') {
  5. return relativePath + '/';
  6. }
  7. return relativePath;
  8. };