embarrassingly parallel for all three steps of sync

This commit is contained in:
fyears
2022-03-19 01:21:22 +08:00
parent 6a820ddfdd
commit f73e6b7796
3 changed files with 138 additions and 79 deletions
+22
View File
@@ -277,3 +277,25 @@ export const getSplitRanges = (bytesTotal: number, bytesEachPart: number) => {
export const getTypeName = (obj: any) => {
return Object.prototype.toString.call(obj).slice(8, -1);
};
/**
* Startting from 1
* @param x
* @returns
*/
export const atWhichLevel = (x: string) => {
if (
x === undefined ||
x === "" ||
x === "." ||
x === ".." ||
x.startsWith("/")
) {
throw Error(`do not know which level for ${x}`);
}
let y = x;
if (x.endsWith("/")) {
y = x.slice(0, -1);
}
return y.split("/").length;
};