index.js
function _fetchRandomSubreddit(count=1, subreddit='random', fetchOpts={}) {
  const _fetchSubredditUrl = (subreddit, fetchOpts) => {
    return fetch(`https://www.reddit.com/r/${subreddit}`, fetchOpts)
      .then(({url}) => {
        return {
          json: `${url}.json`,
          name: getSubredditName(url),
          url
        };
      });
    };
  const promises = [...Array(count)]
    .map(() => _fetchSubredditUrl(subreddit, fetchOpts));

  return Promise.all(promises);
}
function _fetchRandomSubreddit(count=1, subreddit='random', fetchOpts={}) {
  const _fetchSubredditUrl = (subreddit, fetchOpts) => {
    return fetch(`https://www.reddit.com/r/${subreddit}`, fetchOpts)
      .then(({url}) => {
        return {
          json: `${url}.json`,
          name: getSubredditName(url),
          url
        };
      });
    };
  const promises = [...Array(count)]
    .map(() => _fetchSubredditUrl(subreddit, fetchOpts));

  return Promise.all(promises);
}
function _fetchRandomSubreddit ( count = 1 , subreddit = 'random' , fetchOpts = { } ) { const _fetchSubredditUrl = ( subreddit , fetchOpts ) => { return fetch ( ` ${ subreddit } ` , fetchOpts ) . then ( ( { url } ) => { return { json : ` ${ url } ` , name : getSubredditName ( url ) , url } ; } ) ; } ; const promises = [ ... Array ( count ) ] . map ( ( ) => _fetchSubredditUrl ( subreddit , fetchOpts ) ) ; return Promise . all ( promises ) ; }
Proxy method that creates an array of subreddit promises to fetch.

@private
@param  {Number} count     The number of random subreddits to fetch. Default: 1
@param  {String} subreddit Random subreddit generator. Either "random' or "randnsfw" (depending on if yuo want NSFW results). Default: "random" (safe for work)
@param  {Object} fetchOpts Options to pass to the `fetch()` method. Default: `{}`
@return {Array}            Array of subreddit `name` and `url`s.
Proxy method that creates an array of subreddit promises to fetch .