normalize-dir.js 343 B

12345678910111213
  1. "use strict";
  2. var pather = require("path");
  3. function isEndedWithSeparator(filePath) {
  4. return filePath[filePath.length - 1] === pather.sep;
  5. }
  6. function normalizeDirPath(filePath) {
  7. if (isEndedWithSeparator(filePath)) {
  8. return filePath;
  9. } else {
  10. return filePath + pather.sep;
  11. }
  12. }
  13. module.exports = normalizeDirPath;