src/hooks/scriptsFinder.js
function getApplicationHookScriptsFromDir (dir) {
    if (!(fs.existsSync(dir))) {
        return [];
    }

    var compareNumbers = function (a, b) {
        // TODO SG looks very complex, do we really need this?
        return isNaN(parseInt(a, 10)) ? a.toLowerCase().localeCompare(b.toLowerCase ? b.toLowerCase() : b)
            : parseInt(a, 10) > parseInt(b, 10) ? 1 : parseInt(a, 10) < parseInt(b, 10) ? -1 : 0;
    };

    var scripts = fs.readdirSync(dir).sort(compareNumbers).filter(function (s) {
        return s[0] !== '.';
    });
    return scripts.map(function (scriptPath) {
        // for old style hook files we don't use module loader for backward compatibility
        return { path: scriptPath, fullPath: path.join(dir, scriptPath), useModuleLoader: false };
    });
}
function getApplicationHookScriptsFromDir (dir) {
    if (!(fs.existsSync(dir))) {
        return [];
    }

    var compareNumbers = function (a, b) {
        // TODO SG looks very complex, do we really need this?
        return isNaN(parseInt(a, 10)) ? a.toLowerCase().localeCompare(b.toLowerCase ? b.toLowerCase() : b)
            : parseInt(a, 10) > parseInt(b, 10) ? 1 : parseInt(a, 10) < parseInt(b, 10) ? -1 : 0;
    };

    var scripts = fs.readdirSync(dir).sort(compareNumbers).filter(function (s) {
        return s[0] !== '.';
    });
    return scripts.map(function (scriptPath) {
        // for old style hook files we don't use module loader for backward compatibility
        return { path: scriptPath, fullPath: path.join(dir, scriptPath), useModuleLoader: false };
    });
}
Gets application level hooks from the directrory specified.