more misc
This commit is contained in:
parent
0d75ea92b1
commit
2eb1545f9d
14
src/misc.ts
14
src/misc.ts
@ -46,8 +46,8 @@ export const getFolderLevels = (x: string) => {
|
|||||||
let i = 0;
|
let i = 0;
|
||||||
for (let index = 0; index + 1 < y1.length; index++) {
|
for (let index = 0; index + 1 < y1.length; index++) {
|
||||||
const k = y1.slice(0, index + 1).join("/");
|
const k = y1.slice(0, index + 1).join("/");
|
||||||
if (k !== '' && k!== '/') {
|
if (k !== "" && k !== "/") {
|
||||||
res.push(k)
|
res.push(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@ -145,3 +145,13 @@ export const getPathFolder = (a: string) => {
|
|||||||
const b = path.posix.dirname(a);
|
const b = path.posix.dirname(a);
|
||||||
return b.endsWith("/") ? b : `${b}/`;
|
return b.endsWith("/") ? b : `${b}/`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://stackoverflow.com/questions/54511144
|
||||||
|
* @param a
|
||||||
|
* @param delimiter
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const setToString = (a: Set<string>, delimiter: string = ",") => {
|
||||||
|
return [...a].join(delimiter);
|
||||||
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user