index.js
function copyEach(files, dir, options, cb) {
  if (arguments.length < 3) {
    return invalid.apply(null, arguments);
  }

  if (typeof options === 'function') {
    cb = options;
    options = {};
  }

  var opts = utils.extend({}, options);
  if (typeof opts.cwd === 'undefined') {
    opts.cwd = process.cwd();
  }

  if (!opts.srcBase && opts.patterns) {
    opts.srcBase = path.resolve(opts.cwd, utils.parent(opts.patterns));
  }

  utils.each(files, function(filename, next) {
    var filepath = path.resolve(opts.cwd, filename);
    if (utils.isDirectory(filepath)) {
      next()
      return;
    }
    copyOne(filepath, dir, opts, next);
  }, function(err, arr) {
    if (err) {
      cb(err);
      return;
    }
    cb(null, arr.filter(Boolean));
  });
}
function copyEach(files, dir, options, cb) {
  if (arguments.length < 3) {
    return invalid.apply(null, arguments);
  }

  if (typeof options === 'function') {
    cb = options;
    options = {};
  }

  var opts = utils.extend({}, options);
  if (typeof opts.cwd === 'undefined') {
    opts.cwd = process.cwd();
  }

  if (!opts.srcBase && opts.patterns) {
    opts.srcBase = path.resolve(opts.cwd, utils.parent(opts.patterns));
  }

  utils.each(files, function(filename, next) {
    var filepath = path.resolve(opts.cwd, filename);
    if (utils.isDirectory(filepath)) {
      next()
      return;
    }
    copyOne(filepath, dir, opts, next);
  }, function(err, arr) {
    if (err) {
      cb(err);
      return;
    }
    cb(null, arr.filter(Boolean));
  });
}
function copyEach ( files , dir , options , cb ) { if ( arguments . length < 3 ) { return invalid . apply ( null , arguments ) ; } if ( typeof options === 'function' ) { cb = options ; options = { } ; } var opts = utils . extend ( { } , options ) ; if ( typeof opts . cwd === 'undefined' ) { opts . cwd = process . cwd ( ) ; } if ( ! opts . srcBase && opts . patterns ) { opts . srcBase = path . resolve ( opts . cwd , utils . parent ( opts . patterns ) ) ; } utils . each ( files , function ( filename , next ) { var filepath = path . resolve ( opts . cwd , filename ) ; if ( utils . isDirectory ( filepath ) ) { next ( ) return ; } copyOne ( filepath , dir , opts , next ) ; } , function ( err , arr ) { if ( err ) { cb ( err ) ; return ; } cb ( null , arr . filter ( Boolean ) ) ; } ) ; }
Copy an array of files to the given destination `directory`, with
`options` and callback function that exposes `err` and the array of
vinyl files that are created by the copy operation.

```js
copy.each(['foo.txt', 'bar.txt', 'baz.txt'], 'dist', function(err, files) {
// exposes the vinyl `files` created when the files are copied
});
```
@name .copy.each
@param {Array} `files` Filepaths or vinyl files.
@param {String} `dir` Destination directory
@param {Object|Function} `options` or callback function
@param {Function} `cb` Callback function if no options are specified
@api public
Copy an array of files to the given destination directory with options and callback function that exposes err and the array of vinyl files that are created by the copy operation .