index.js
function (options, callback) {
    var reqOptions = {
      endpoint: 'trending'
    };

    reqOptions.api = (options ? options.api : null) || 'gifs';

    // Cleanup so we don't add this to our query
    if (options) {
      delete options.api;
    }

    if (typeof options === 'object' &&
      Object.keys(options).length !== 0) {
      reqOptions.query = options;
    } else if (typeof options === 'function') {
      callback = options;
    }

    return this._request(reqOptions, callback);
  }
function (options, callback) {
    var reqOptions = {
      endpoint: 'trending'
    };

    reqOptions.api = (options ? options.api : null) || 'gifs';

    // Cleanup so we don't add this to our query
    if (options) {
      delete options.api;
    }

    if (typeof options === 'object' &&
      Object.keys(options).length !== 0) {
      reqOptions.query = options;
    } else if (typeof options === 'function') {
      callback = options;
    }

    return this._request(reqOptions, callback);
  }
function ( options , callback ) { var reqOptions = { endpoint : 'trending' } ; reqOptions . api = ( options ? options . api : null ) || 'gifs' ; // Cleanup so we don't add this to our query if ( options ) { delete options . api ; } if ( typeof options === 'object' && Object . keys ( options ) . length !== 0 ) { reqOptions . query = options ; } else if ( typeof options === 'function' ) { callback = options ; } return this . _request ( reqOptions , callback ) ; }
Fetch trending gifs

@param options Giphy API random options
options.limit {Number} - (optional) limits the number of results returned. By default returns 25 results.
options.rating {String} - limit results to those rated (y,g, pg, pg-13 or r).
options.fmt {String} - (optional) return results in html or json format (useful for viewing responses as GIFs to debug/test)
Fetch trending gifs