mirror of
https://github.com/ASzc/change-string-case-action.git
synced 2024-11-24 01:23:51 +08:00
20 lines
539 B
JavaScript
20 lines
539 B
JavaScript
import { auth } from "./auth";
|
|
import { hook } from "./hook";
|
|
const createTokenAuth = function createTokenAuth2(token) {
|
|
if (!token) {
|
|
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
|
}
|
|
if (typeof token !== "string") {
|
|
throw new Error(
|
|
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
|
|
);
|
|
}
|
|
token = token.replace(/^(token|bearer) +/i, "");
|
|
return Object.assign(auth.bind(null, token), {
|
|
hook: hook.bind(null, token)
|
|
});
|
|
};
|
|
export {
|
|
createTokenAuth
|
|
};
|