You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
337 B
12 lines
337 B
const { sep, normalize } = require("path");
|
|
|
|
function cleanPath(dirPath) {
|
|
let normalized = normalize(dirPath);
|
|
|
|
// to account for / path
|
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
|
|
normalized = normalized.substring(0, normalized.length - 1);
|
|
return normalized;
|
|
}
|
|
|
|
module.exports = { cleanPath };
|
|
|