The original Code:
原始代码:
'use strict';
function GitJs(config) {
var defaults = {
inheriting: false,
clientId: undefined,
accessToken: undefined,
baseUrl: 'https://api.github.com',
mode: 'read'
};
this.config = $.extend(defaults, config);
}
/**
* Gets the jQuery method that GitJs#generateApiRequest is going to use to send the ajax request.
*
* @param {string} httpVerb The HTTP verb that the request will use,
* @return string
*/
GitJs.prototype.getCommandMethod = function (httpVerb) {
var method = $.get;
switch (httpVerb) {
case 'GET':
method = $.get;
break;
case 'POST':
method = $.post;
break;
}
return method;
};
...
'use strict';
func