Add octokit

This commit is contained in:
Rachael Sewell
2019-08-06 20:56:08 -07:00
parent ba3261b69d
commit 332696c680
122 changed files with 55351 additions and 0 deletions

View File

@ -0,0 +1,21 @@
export function addQueryParameters(url, parameters) {
const separator = /\?/.test(url) ? "&" : "?";
const names = Object.keys(parameters);
if (names.length === 0) {
return url;
}
return (url +
separator +
names
.map(name => {
if (name === "q") {
return ("q=" +
parameters
.q.split("+")
.map(encodeURIComponent)
.join("+"));
}
return `${name}=${encodeURIComponent(parameters[name])}`;
})
.join("&"));
}