Comparing version 1.2.1 to 2.0.0
@@ -62,4 +62,4 @@ # :eight_spoked_asterisk: :stars: :sparkles: :dizzy: :star2: :star2: :sparkles: :dizzy: :star2: :star2: Contributing :star: :star2: :dizzy: :sparkles: :star: :star2: :dizzy: :sparkles: :stars: :eight_spoked_asterisk: | ||
[1]: https://github.com/IonicaBizau/node-git-up/issues | ||
[1]: https://github.com/IonicaBizau/git-up/issues | ||
[2]: https://github.com/IonicaBizau/code-style |
// Dependencies | ||
var GitUp = require("../lib"); | ||
var gitUp = require("../lib"); | ||
console.log(GitUp("git@github.com:IonicaBizau/node-parse-url.git")); | ||
console.log(gitUp("git@github.com:IonicaBizau/node-parse-url.git")); | ||
// => { | ||
@@ -17,3 +17,3 @@ // protocols: [] | ||
console.log(GitUp("https://github.com/IonicaBizau/node-parse-url.git")); | ||
console.log(gitUp("https://github.com/IonicaBizau/node-parse-url.git")); | ||
// => { | ||
@@ -20,0 +20,0 @@ // protocols: [ "https" ] |
@@ -0,11 +1,13 @@ | ||
"use strict"; | ||
// Dependencies | ||
var ParseUrl = require("parse-url") | ||
, IsSsh = require("is-ssh") | ||
; | ||
const parseUrl = require("parse-url") | ||
, isSsh = require("is-ssh") | ||
; | ||
/** | ||
* GitUp | ||
* gitUp | ||
* Parses the input url. | ||
* | ||
* @name GitUp | ||
* @name gitUp | ||
* @function | ||
@@ -26,7 +28,7 @@ * @param {String} input The input url. | ||
*/ | ||
function GitUp(input) { | ||
var output = ParseUrl(input); | ||
function gitUp(input) { | ||
let output = parseUrl(input); | ||
output.token = ""; | ||
splits = output.user.split(":"); | ||
let splits = output.user.split(":"); | ||
if (splits.length === 2) { | ||
@@ -40,3 +42,3 @@ if (splits[1] === "x-oauth-basic") { | ||
if (IsSsh(output.protocols) || IsSsh(input)) { | ||
if (isSsh(output.protocols) || isSsh(input)) { | ||
output.protocol = "ssh"; | ||
@@ -52,2 +54,2 @@ } else if (output.protocols.length) { | ||
module.exports = GitUp; | ||
module.exports = gitUp; |
{ | ||
"name": "git-up", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "A low level git url parser.", | ||
@@ -11,7 +11,7 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"test": "mocha test" | ||
"test": "node test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/IonicaBizau/node-git-up.git" | ||
"url": "https://github.com/IonicaBizau/git-up.git" | ||
}, | ||
@@ -27,8 +27,8 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/IonicaBizau/node-git-up/issues" | ||
"url": "https://github.com/IonicaBizau/git-up/issues" | ||
}, | ||
"homepage": "https://github.com/IonicaBizau/node-git-up", | ||
"homepage": "https://github.com/IonicaBizau/git-up", | ||
"dependencies": { | ||
"is-ssh": "^1.0.0", | ||
"parse-url": "^1.0.0" | ||
"is-ssh": "^1.3.0", | ||
"parse-url": "^1.3.0" | ||
}, | ||
@@ -38,2 +38,2 @@ "devDependencies": { | ||
} | ||
} | ||
} |
@@ -15,5 +15,5 @@ # git-up [![PayPal](https://img.shields.io/badge/%24-paypal-f39c12.svg)][paypal-donations] [![Version](https://img.shields.io/npm/v/git-up.svg)](https://www.npmjs.com/package/git-up) [![Downloads](https://img.shields.io/npm/dt/git-up.svg)](https://www.npmjs.com/package/git-up) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github) | ||
// Dependencies | ||
var GitUp = require("git-up"); | ||
var gitUp = require("git-up"); | ||
console.log(GitUp("git@github.com:IonicaBizau/node-parse-url.git")); | ||
console.log(gitUp("git@github.com:IonicaBizau/node-parse-url.git")); | ||
// => { | ||
@@ -31,3 +31,3 @@ // protocols: [] | ||
console.log(GitUp("https://github.com/IonicaBizau/node-parse-url.git")); | ||
console.log(gitUp("https://github.com/IonicaBizau/node-parse-url.git")); | ||
// => { | ||
@@ -48,3 +48,3 @@ // protocols: [ "https" ] | ||
### `GitUp(input)` | ||
### `gitUp(input)` | ||
Parses the input url. | ||
@@ -74,3 +74,3 @@ | ||
- [`git-url-parse`](https://github.com/IonicaBizau/node-git-url-parse) | ||
- [`git-url-parse`](https://github.com/IonicaBizau/git-url-parse) | ||
@@ -77,0 +77,0 @@ ## License |
// Dependencies | ||
var GitUp = require("../lib") | ||
, Assert = require("assert") | ||
; | ||
const gitUp = require("../lib") | ||
, tester = require("tester") | ||
; | ||
const INPUT = [ | ||
@@ -26,2 +25,3 @@ // Secure Shell Transport Protocol (SSH) | ||
protocols: ["git", "ssh"] | ||
, protocol: "ssh" | ||
, port: null | ||
@@ -412,8 +412,13 @@ , resource: "host.xz" | ||
INPUT.forEach(function (c) { | ||
it("should support " + c[0], function (cb) { | ||
c[1].href = c[0]; | ||
Assert.deepEqual(GitUp(c[0]), c[1]); | ||
cb(); | ||
tester.describe("git-url-parse", test => { | ||
INPUT.forEach(function (c) { | ||
test.should("support " + c[0], () => { | ||
c[1].href = c[0]; | ||
c[1].protocol = c[1].protocols[0]; | ||
c[1].token = c[1].token || ""; | ||
try { | ||
test.expect(gitUp(c[0])).toEqual(c[1]); | ||
} catch (e) { debugger } | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19399
489
Updatedis-ssh@^1.3.0
Updatedparse-url@^1.3.0