code: function done() {
        // We don't care if we were rejected.
        if (rejected === true) {
          return;
        }
        // Decrement the number of async tasks we are waiting on.
        waiting--;
        // If we are finished waiting then we want to resolve our promise.
        if (waiting <= 0) {
          if (waiting === 0) {
            _resolve(filePaths);
          } else {
            reject(new Error(`Expected a positive number: ${waiting}`));
          }
        }
      }
docs: Our implementation of resolve that will only actually resolve if we are
  done waiting everywhere.