Socket
Socket
Sign inDemoInstall

node-url-from-git

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-url-from-git

parse url from git repo, support github.com and also company specific git repo url


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Install size
7.76 kB
Created
Weekly downloads
 

Readme

Source

node-url-from-git

Build Status

describe('index.test.js', function () {
    it('should support git://*', function () {
      var url = 'git://github.com/jamesor/mongoose-versioner';
      parser(url).should.equal('github.com/jamesor/mongoose-versioner');
    });

    it('should support git://*.git', function () {
      var url = 'git://github.com/treygriffith/cellar.git';
      parser(url).should.equal('github.com/treygriffith/cellar');
    });

    it('should support https://*', function () {
      var url = 'https://github.com/Empeeric/i18n-node';
      parser(url).should.equal('github.com/Empeeric/i18n-node');
    });

    it('should parse https://*.git', function () {
      var url = 'https://jpillora@github.com/banchee/tranquil.git';
      parser(url).should.equal('github.com/banchee/tranquil');
    });

    it('should return undefined on failure', function () {
      var url = 'git://github.com/justgord/.git';
      assert(parser(url) == null);
    });

    it('should parse git@gist urls', function () {
      var url = 'git@gist.github.com:3135914.git';
      parser(url).should.equal('gist.github.com/3135914');
    });

    it('should parse https://gist urls', function () {
      var url = 'https://gist.github.com/3135914.git';
      parser(url).should.equal('gist.github.com/3135914');
    });

    it('should parse git@github urls', function () {
      var url = 'git@github.com:AdoHe/ImageServer.git';
      parser(url).should.equal('github.com/AdoHe/ImageServer');
    });

    it('should parse company specific git@* urls', function () {
      var url = 'git@dev.sh.westudio.com:framework/Tunnel.git';
      parser(url).should.equal('dev.sh.westudio.com/framework/Tunnel');
    });
})

describe('re', function () {
    it('should get the url parse regex', function () {
        parser.re.source.should.equal(
            /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?((?:\w+.?){1,}\w+)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source
        )
    });
})

Keywords

FAQs

Last updated on 15 Jul 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc