Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
53
Frontend-Learner/node_modules/git-up/lib/index.d.ts
generated
vendored
Normal file
53
Frontend-Learner/node_modules/git-up/lib/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import parseUrl = require("parse-url");
|
||||
|
||||
export = gitUp;
|
||||
|
||||
/**
|
||||
* A low level git url parser. Parses the `input` url.
|
||||
*
|
||||
* @param input The url as string.
|
||||
* @returns The parsed url.
|
||||
*
|
||||
* @example
|
||||
* import gitUp = require("git-up");
|
||||
*
|
||||
* console.log(gitUp("git@github.com:IonicaBizau/node-parse-url.git"));
|
||||
* // => {
|
||||
* // protocols: []
|
||||
* // , port: ""
|
||||
* // , resource: "github.com"
|
||||
* // , user: "git"
|
||||
* // , pathname: "/IonicaBizau/node-parse-url.git"
|
||||
* // , hash: ""
|
||||
* // , search: ""
|
||||
* // , href: "git@github.com:IonicaBizau/node-parse-url.git"
|
||||
* // , protocol: "ssh"
|
||||
* // }
|
||||
*
|
||||
* console.log(gitUp("https://github.com/IonicaBizau/node-parse-url.git"));
|
||||
* // => {
|
||||
* // protocols: [ "https" ]
|
||||
* // , port: ""
|
||||
* // , resource: "github.com"
|
||||
* // , user: ""
|
||||
* // , pathname: "/IonicaBizau/node-parse-url.git"
|
||||
* // , hash: ""
|
||||
* // , search: ""
|
||||
* // , href: "https://github.com/IonicaBizau/node-parse-url.git"
|
||||
* // , protocol: "https"
|
||||
* // }
|
||||
*/
|
||||
declare function gitUp(input: string): gitUp.ParsedUrl;
|
||||
|
||||
declare namespace gitUp {
|
||||
interface ParsedUrl extends parseUrl.ParsedUrl {
|
||||
/**
|
||||
* The oauth token (could appear in the https urls).
|
||||
*
|
||||
* An empty string if not found.
|
||||
* Set from user if password is `x-oauth-basic`.
|
||||
* Set from password if user is `x-token-auth`.
|
||||
*/
|
||||
token: string;
|
||||
}
|
||||
}
|
||||
51
Frontend-Learner/node_modules/git-up/lib/index.js
generated
vendored
Normal file
51
Frontend-Learner/node_modules/git-up/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"use strict";
|
||||
|
||||
// Dependencies
|
||||
const parseUrl = require("parse-url")
|
||||
, isSsh = require("is-ssh")
|
||||
;
|
||||
|
||||
/**
|
||||
* gitUp
|
||||
* Parses the input url.
|
||||
*
|
||||
* @name gitUp
|
||||
* @function
|
||||
* @param {String} input The input url.
|
||||
* @return {Object} An object containing the following fields:
|
||||
*
|
||||
* - `protocols` (Array): An array with the url protocols (usually it has one element).
|
||||
* - `port` (String): The domain port.
|
||||
* - `resource` (String): The url domain (including subdomains).
|
||||
* - `user` (String): The authentication user (usually for ssh urls).
|
||||
* - `pathname` (String): The url pathname.
|
||||
* - `hash` (String): The url hash.
|
||||
* - `search` (String): The url querystring value.
|
||||
* - `href` (String): The input url.
|
||||
* - `protocol` (String): The git url protocol.
|
||||
* - `token` (String): The oauth token (could appear in the https urls).
|
||||
*/
|
||||
function gitUp(input) {
|
||||
let output = parseUrl(input);
|
||||
output.token = "";
|
||||
|
||||
if (output.password === "x-oauth-basic") {
|
||||
output.token = output.user;
|
||||
} else if (output.user === "x-token-auth") {
|
||||
output.token = output.password
|
||||
}
|
||||
|
||||
if (isSsh(output.protocols) || (output.protocols.length === 0 && isSsh(input))) {
|
||||
output.protocol = "ssh";
|
||||
} else if (output.protocols.length) {
|
||||
output.protocol = output.protocols[0];
|
||||
} else {
|
||||
output.protocol = "file";
|
||||
output.protocols = ["file"]
|
||||
}
|
||||
|
||||
output.href = output.href.replace(/\/$/, "")
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = gitUp;
|
||||
Loading…
Add table
Add a link
Reference in a new issue