summaryrefslogtreecommitdiff
path: root/desktop/node_modules/dir-compare/build/src/entry/entryComparator.js
blob: 58d0cb3db951f00ab8508912a3ad857686bbe71f (plain)
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
/**
 * Determines order criteria for sorting entries in a directory.
 */
module.exports = {
    compareEntry(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);
        }
    }
};
//# sourceMappingURL=entryComparator.js.map