docs: function map(promise, mapFunc) {
              return well(promise, function (array) {
                  var results, len, toResolve, resolve, i, d;
  
                  // Since we know the resulting length, we can preallocate the results
                  // array to avoid array expansions.
                  toResolve = len = array.length >>> 0;
                  results = [];
                  d = defer();
  
                  if (!toResolve) {
                      d.resolve(results);
                  } else {
  
                      resolve = function resolveOne(item, i) {
                          well(item, mapFunc).then(function (mapped) {
                              results[i] = mapped;
  
                              if (!--toResolve) {
                                  d.resolve(results);
                              }
                          }, d.reject);
                      };
  
                      // Since mapFunc may be async, get all invocations of it into flight
                      for (i = 0; i < len; i++) {
                          if (i in array) {
                              resolve(array[i], i);
                          } else {
                              --toResolve;
                          }
                      }
  
                  }
  
                  return d.promise;
  
              });
          }