diff options
author | Robert Kowalski <rok@kowalski.gd> | 2014-04-17 00:21:10 +0400 |
---|---|---|
committer | Domenic Denicola <domenic@domenicdenicola.com> | 2014-04-18 07:25:40 +0400 |
commit | d173bc2c0188e429a6f85651dab8f3ef6329c890 (patch) | |
tree | 797c151a38a56113794f7146b00fee6079e8aa23 /node_modules | |
parent | 0c935a3970acddb657fe4b5c06fdc9974ae01542 (diff) |
github-url-from-username-repo@0.1.0
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/github-url-from-username-repo/index.js | 6 | ||||
-rw-r--r-- | node_modules/github-url-from-username-repo/package.json | 11 | ||||
-rw-r--r-- | node_modules/github-url-from-username-repo/test/index.js | 27 |
3 files changed, 31 insertions, 13 deletions
diff --git a/node_modules/github-url-from-username-repo/index.js b/node_modules/github-url-from-username-repo/index.js index 8af2c4f83..46b0bb513 100644 --- a/node_modules/github-url-from-username-repo/index.js +++ b/node_modules/github-url-from-username-repo/index.js @@ -1,9 +1,9 @@ module.exports = getUrl function getUrl (r) { - if (!r) return - if (/^[\w-]+\/[\w-]+$/.test(r)) + if (!r) return null + if (/^[\w-]+\/[\w\.-]+$/.test(r)) return "git://github.com/" + r else return null -}
\ No newline at end of file +} diff --git a/node_modules/github-url-from-username-repo/package.json b/node_modules/github-url-from-username-repo/package.json index d0e241dbf..239ba7739 100644 --- a/node_modules/github-url-from-username-repo/package.json +++ b/node_modules/github-url-from-username-repo/package.json @@ -1,6 +1,6 @@ { "name": "github-url-from-username-repo", - "version": "0.0.2", + "version": "0.1.0", "description": "Create urls from username/repo", "main": "index.js", "scripts": { @@ -28,6 +28,11 @@ ], "readme": "[![Build Status](https://travis-ci.org/robertkowalski/github-url-from-username-repo.png?branch=master)](https://travis-ci.org/robertkowalski/github-url-from-username-repo)\n[![Dependency Status](https://gemnasium.com/robertkowalski/github-url-from-username-repo.png)](https://gemnasium.com/robertkowalski/github-url-from-username-repo)\n\n\n# github-url-from-username-repo\n\n## Usage\n\n```javascript\n\nvar getUrl = require(\"github-url-from-username-repo\")\ngetUrl(\"visionmedia/express\") // git://github.com/visionmedia/express\n\n```", "readmeFilename": "README.md", - "_id": "github-url-from-username-repo@0.0.2", - "_from": "github-url-from-username-repo@" + "homepage": "https://github.com/robertkowalski/github-url-from-username-repo", + "_id": "github-url-from-username-repo@0.1.0", + "dist": { + "shasum": "fe398af670692e91af7bcfc5ae1d99ff97b1df89" + }, + "_from": "github-url-from-username-repo@0.1.0", + "_resolved": "https://registry.npmjs.org/github-url-from-username-repo/-/github-url-from-username-repo-0.1.0.tgz" } diff --git a/node_modules/github-url-from-username-repo/test/index.js b/node_modules/github-url-from-username-repo/test/index.js index 782a95cea..e8e7b4760 100644 --- a/node_modules/github-url-from-username-repo/test/index.js +++ b/node_modules/github-url-from-username-repo/test/index.js @@ -6,16 +6,29 @@ describe("github url from username/repo", function () { var url = getUrl("visionmedia/express") assert.equal("git://github.com/visionmedia/express", url) }) - it("works with -", function () { - var url = getUrl("vision-media/express-package") - assert.equal("git://github.com/vision-media/express-package", url) - }) + it("returns null if it does not match", function () { var url = getUrl("package") assert.deepEqual(null, url) }) - it("returns undefined if no repo/user was given", function () { + + it("returns null if no repo/user was given", function () { var url = getUrl() - assert.deepEqual(undefined, url) + assert.deepEqual(null, url) + }) + + it("works with .", function () { + var url = getUrl("component/downloader.js") + assert.equal("git://github.com/component/downloader.js", url) + }) + + it("works with . in the beginning", function () { + var url = getUrl("component/.downloader.js") + assert.equal("git://github.com/component/.downloader.js", url) + }) + + it("works with -", function () { + var url = getUrl("component/-dow-nloader.j-s") + assert.equal("git://github.com/component/-dow-nloader.j-s", url) }) -})
\ No newline at end of file +}) |