path.js 705 B

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var path = require("path");
  4. /**
  5. * Returns «true» if the last partial of the path starting with a period.
  6. */
  7. function isDotDirectory(filepath) {
  8. return path.basename(filepath).startsWith('.');
  9. }
  10. exports.isDotDirectory = isDotDirectory;
  11. /**
  12. * Convert a windows-like path to a unix-style path.
  13. */
  14. function normalize(filepath) {
  15. return filepath.replace(/\\/g, '/');
  16. }
  17. exports.normalize = normalize;
  18. /**
  19. * Returns normalized absolute path of provided filepath.
  20. */
  21. function makeAbsolute(cwd, filepath) {
  22. return normalize(path.resolve(cwd, filepath));
  23. }
  24. exports.makeAbsolute = makeAbsolute;