Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 47x 47x 18x 47x | import path from "path"; export const pathToPosix = (filepath: string): string => filepath.split(path.sep).join(path.posix.sep); export const naturalSortPaths = (filepaths: string[]): string[] => { return [...filepaths].sort((a, b) => { const splitA = a.split(/[\\/]/); const splitB = b.split(/[\\/]/); const len = Math.min(splitA.length, splitB.length); for (let i = 0; i < len; i++) { const aPart = splitA[i].replace(/\.[^.]*/, ""); const bPart = splitB[i].replace(/\.[^.]*/, ""); Iif (aPart !== bPart) { return aPart.localeCompare(bPart, undefined, { numeric: true, sensitivity: "base", }); } } Iif (splitA.length > splitB.length) { return 1; } Iif (splitA.length < splitB.length) { return -1; } return 0; }); }; |