chore: apply automatic linting

This commit is contained in:
Corbin Crutchley
2022-09-25 05:51:04 -07:00
parent 5d628203d3
commit 3900a13481
92 changed files with 4787 additions and 4694 deletions

View File

@@ -9,33 +9,35 @@ import slash from "slash";
export const absolutePathRegex = /^(?:[a-z]+:)?\/\//;
export const isRelativePath = (str: string) => {
const isAbsolute = absolutePathRegex.exec(str);
if (isAbsolute) return false;
return true;
const isAbsolute = absolutePathRegex.exec(str);
if (isAbsolute) return false;
return true;
};
var pathJoin = function(...pathArr){
return pathArr.map(function(path){
if(path[0] === "/"){
path = path.slice(1);
}
if (path.startsWith('./')) {
path = path.slice(2);
}
if(path[path.length - 1] === "/"){
path = path.slice(0, path.length - 1);
}
return path;
}).join("/");
}
const pathJoin = function (...pathArr) {
return pathArr
.map(function (path) {
if (path[0] === "/") {
path = path.slice(1);
}
if (path.startsWith("./")) {
path = path.slice(2);
}
if (path[path.length - 1] === "/") {
path = path.slice(0, path.length - 1);
}
return path;
})
.join("/");
};
export const getFullRelativePath = (...paths: string[]) => {
return isRelativePath(paths[paths.length - 1])
? slash(pathJoin(...paths))
: paths[paths.length - 1];
return isRelativePath(paths[paths.length - 1])
? slash(pathJoin(...paths))
: paths[paths.length - 1];
};
export const trimTrailingSlash = (path: string) => {
if (path.endsWith("/")) return path.slice(0, path.length - 1);
return path;
if (path.endsWith("/")) return path.slice(0, path.length - 1);
return path;
};