15815213711
2024-08-26 67b8b6731811983447e053d4396b3708c14dfe3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
 * Determines order criteria for sorting entries in a directory.
 */
module.exports = {
    compareEntry: function (a, b, options) {
        if (a.isBrokenLink && b.isBrokenLink) {
            return options.compareNameHandler(a.name, b.name, options)
        } else if (a.isBrokenLink) {
            return -1
        } else if (b.isBrokenLink) {
            return 1
        } else if (a.stat.isDirectory() && b.stat.isFile()) {
            return -1
        } else if (a.stat.isFile() && b.stat.isDirectory()) {
            return 1
        } else {
            return options.compareNameHandler(a.name, b.name, options)
        }
    }
}