lib/gulp-import-tasks.js
function handleFile(dir, options) {
  return filename => {
    const file = parseFile(dir, filename);

    debug(`found "${filename}"`);

    // Exit early if this item is not a file.
    if (!file.stat.isFile()) {
      debug(`skipped "${filename}" (not a file)`);
      return;
    }

    // Exit early if this item is not the right file type.
    if (!options.extensions.includes(file.ext)) {
      debug(`skipped "${filename}" (incorrect file type)`);
      return;
    }

    registerTask(file, options);
  };
}
function handleFile(dir, options) {
  return filename => {
    const file = parseFile(dir, filename);

    debug(`found "${filename}"`);

    // Exit early if this item is not a file.
    if (!file.stat.isFile()) {
      debug(`skipped "${filename}" (not a file)`);
      return;
    }

    // Exit early if this item is not the right file type.
    if (!options.extensions.includes(file.ext)) {
      debug(`skipped "${filename}" (incorrect file type)`);
      return;
    }

    registerTask(file, options);
  };
}
function handleFile ( dir , options ) { return filename => { const file = parseFile ( dir , filename ) ; debug ( ` ${ filename } ` ) ; // Exit early if this item is not a file. if ( ! file . stat . isFile ( ) ) { debug ( ` ${ filename } ` ) ; return ; } // Exit early if this item is not the right file type. if ( ! options . extensions . includes ( file . ext ) ) { debug ( ` ${ filename } ` ) ; return ; } registerTask ( file , options ) ; } ; }
Creates a closure that is invoked for each item in the chosen directory.
Verifies that the item is a file and of the correct type, then registers
the task.

@param {string} dir
@param {Object} options
@returns {Function}
Creates a closure that is invoked for each item in the chosen directory . Verifies that the item is a file and of the correct type then registers the task .