lib/extends/_extractFiles.js
function _extractRealFiles (dir, givenFiles, realFiles, callback) {

			if (0 >= givenFiles.length) {
				return callback(null, realFiles);
			}
			else {

				const file = join(dir, givenFiles.shift()).trim();

				return isFileProm(file).then((exists) => {

					if (exists) {
						realFiles.push(file);
					}

					_extractRealFiles(dir, givenFiles, realFiles, callback);

				}).catch(callback);

			}

		}
function _extractRealFiles (dir, givenFiles, realFiles, callback) {

			if (0 >= givenFiles.length) {
				return callback(null, realFiles);
			}
			else {

				const file = join(dir, givenFiles.shift()).trim();

				return isFileProm(file).then((exists) => {

					if (exists) {
						realFiles.push(file);
					}

					_extractRealFiles(dir, givenFiles, realFiles, callback);

				}).catch(callback);

			}

		}
function _extractRealFiles ( dir , givenFiles , realFiles , callback ) { if ( 0 >= givenFiles . length ) { return callback ( null , realFiles ) ; } else { const file = join ( dir , givenFiles . shift ( ) ) . trim ( ) ; return isFileProm ( file ) . then ( ( exists ) => { if ( exists ) { realFiles . push ( file ) ; } _extractRealFiles ( dir , givenFiles , realFiles , callback ) ; } ) . catch ( callback ) ; } }
methods 
Specific to "extractFiles" method, return only the existing files
@param {string} dir : directory to work with
@param {Array} givenFiles : files detected in the directory
@param {Array} realFiles : files detected as real files
@param {function|null} callback : operation's result
@returns {Promise} Operation's result
methods Specific to extractFiles method return only the existing files