docs: function expand(input, options, next) {
    var cwd = options.cwd
    var paths = []
    var actual = 0
    var expected = 0
    var failed
  
    input.forEach(each)
  
    if (!expected) {
      search(paths, options, done)
    }
  
    function each(file) {
      if (string(file)) {
        if (magic(file)) {
          expected++
          glob(file, {cwd: cwd}, one)
        } else {
          /* `relative` to make the paths canonical. */
          file = relative(cwd, resolve(cwd, file)) || '.'
          paths.push(file)
        }
      } else {
        file.cwd = cwd
        file.path = relative(cwd, file.path)
        file.history = [file.path]
        paths.push(file)
      }
    }
  
    function one(error, files) {
      /* istanbul ignore if - glob errors are unusual. */
      if (failed) {
        return
      }
  
      /* istanbul ignore if - glob errors are unusual. */
      if (error) {
        failed = true
        done(error)
      } else {
        actual++
        paths = paths.concat(files)
  
        if (actual === expected) {
          search(paths, options, done)
        }
      }
    }
  
    function done(error, files) {
      /* istanbul ignore if - `search` currently does not give errors. */
      if (error) {
        next(error)
      } else {
        next(null, {input: paths, output: files})
      }
    }
  }