build/index.js
function globCaches(pathsArray) {
    let deepIndex = [];
    let mergedIndex;
    // checking that previousCacheDir content is an array
    if (!Array.isArray(pathsArray)) {
        logger_1.logger.log('warn', 'previousCacheDir variable from config file is not an Array');
        throw 'stop execution';
    }
    //checking if pathsArray contains some empty string. If yes, we do not considerate them.
    if (pathsArray.includes('')) {
        let indexToRemove = pathsArray.map((e, i) => e === "" ? i : '').filter(String);
        pathsArray = pathsArray.filter(function (element) { return element !== ''; });
    }
    // finding pattern of jobID.json inside cache path
    for (let element in pathsArray) {
        deepIndex.push(glob.sync(pathsArray[element] + "/**/jobID\.json", { follow: true }));
        logger_1.logger.log('debug', `${deepIndex[element].length} jobID.json file(s) found in directory ${pathsArray[element]}`);
    }
    // merged array of array into simple array of all path that contain a jobID.json file
    mergedIndex = [].concat.apply([], deepIndex);
    logger_1.logger.log('debug', `list of all jobID.json file(s) found \n ${JSON.stringify(mergedIndex)} \n`);
    return mergedIndex;
}
function globCaches(pathsArray) {
    let deepIndex = [];
    let mergedIndex;
    // checking that previousCacheDir content is an array
    if (!Array.isArray(pathsArray)) {
        logger_1.logger.log('warn', 'previousCacheDir variable from config file is not an Array');
        throw 'stop execution';
    }
    //checking if pathsArray contains some empty string. If yes, we do not considerate them.
    if (pathsArray.includes('')) {
        let indexToRemove = pathsArray.map((e, i) => e === "" ? i : '').filter(String);
        pathsArray = pathsArray.filter(function (element) { return element !== ''; });
    }
    // finding pattern of jobID.json inside cache path
    for (let element in pathsArray) {
        deepIndex.push(glob.sync(pathsArray[element] + "/**/jobID\.json", { follow: true }));
        logger_1.logger.log('debug', `${deepIndex[element].length} jobID.json file(s) found in directory ${pathsArray[element]}`);
    }
    // merged array of array into simple array of all path that contain a jobID.json file
    mergedIndex = [].concat.apply([], deepIndex);
    logger_1.logger.log('debug', `list of all jobID.json file(s) found \n ${JSON.stringify(mergedIndex)} \n`);
    return mergedIndex;
}
/*
Function that manage the indexing of an array of caches path directory
@pathsArray: array of strings which contain cache directory paths.
#deepIndex : result of glob package (array of array).
#mergedIndex : transforminf array of array into a simple array.