change-string-case/node_modules/@octokit/auth-token/dist-src/index.js

20 lines
539 B
JavaScript
Raw Normal View History

2022-11-04 00:55:07 +08:00
import { auth } from "./auth";
import { hook } from "./hook";
2023-10-26 04:27:07 +08:00
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
2022-11-04 00:55:07 +08:00
};