git-command-helper
Version:
github command helper for nodejs
18 lines (16 loc) • 495 B
JavaScript
// git-command-helper 2.1.0 by Dimas Lanjaka <dimaslanjaka@gmail.com> (https://www.webmanajemen.com)
/**
* remove `token` from url.
*
* @example
* // from : https://TOKEN@github.com/username/repository-name/blob/filename#L01-L202
* // to : https://github.com/username/repository-name/blob/filename#L01-L202
* @param url
* @returns
*/
function safeURL(url) {
const parse = new URL(url);
const safe = parse.origin + parse.pathname + parse.hash;
return safe;
}
export { safeURL };