paulomcnally / youtube-node

Youtube api implementation for nodeJS

Home Page:https://www.npmjs.com/package/youtube-node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getPlayListsItemsById second parameter has incorrect documentation

niklasHagner opened this issue · comments

This function takes the params (id, maxResults, callback) .
But the comment incorrectly specifies them as id, id and callback.

The comment should be updated, changing the id to maxResults.

  /**
  * Playlists data from Playlist Id
  * @param {string} id
  * @param {int} id
  * @param {function} callback
  * https://developers.google.com/youtube/v3/docs/playlistItems/list
  */
  self.getPlayListsItemsById = function(id, maxResults, callback) {

    var validate = self.validate();
    
    if(typeof(maxResults) == "function"){
      callback = maxResults;
      maxResults = null;
    }

    if (validate !== null) {
      callback(validate);
    }
    else {
      self.clearParams();
      self.clearParts();

      self.addPart('contentDetails');
      self.addPart('id');
      self.addPart('snippet');
      self.addPart('status');

      self.addParam('part', self.getParts());
      self.addParam('playlistId', id);

      maxResults && self.addParam('maxResults', maxResults);

      self.request(self.getUrl('playlistItems'), callback);
    }
  };

https://github.com/nodenica/youtube-node/blob/129c1cbbc7a00331085392a6090cac83114e2ad9/lib/youtube.js

I see there are discussions here about changing the params for this function.

But I figure this is such a miniscule change that it might be worth doing in the meantime.

Just so no one else who reads the comments gets confused.
(which I did)