1
0
Files
stale/node_modules/@octokit/rest/plugins/authentication/validate.js
T

22 lines
355 B
JavaScript
Raw Normal View History

2020-05-15 15:25:57 -04:00
module.exports = validateAuth;
2019-08-06 17:37:58 -04:00
2020-05-15 15:25:57 -04:00
function validateAuth(auth) {
if (typeof auth === "string") {
return;
2019-08-06 17:37:58 -04:00
}
2020-05-15 15:25:57 -04:00
if (typeof auth === "function") {
return;
2019-08-06 17:37:58 -04:00
}
if (auth.username && auth.password) {
2020-05-15 15:25:57 -04:00
return;
2019-08-06 17:37:58 -04:00
}
if (auth.clientId && auth.clientSecret) {
2020-05-15 15:25:57 -04:00
return;
2019-08-06 17:37:58 -04:00
}
2020-05-15 15:25:57 -04:00
throw new Error(`Invalid "auth" option: ${JSON.stringify(auth)}`);
2019-08-06 17:37:58 -04:00
}