Socket
Book a DemoInstallSign in
Socket

discern

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discern

Discern information about git and github urls.

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
2
Created
Source

Discern

Discern information about git and github urls.

Build Status Dependency Status NPM version

Installation

$ npm install discern

API

folder(dir, callback) / folder.sync(dir)

For a folder that represents a github url, this will attempt to return the "origin" remote. On failure, it returns null.

github(url)

Takes a github url with the optional extension of using #branch-name on the end to denote a branch/tag/commit. It returns an array containing [user, repo, branch] where branch defaults to master. This can be used to build the GitHub url, a url to the tarball etc. etc.

normalize(url)

Currently just a pass through, but the aim will be to get git urls as close as possible to some normal form. In particular, it should do the work required by npm's addRemoteGit

isGitUrl(url)

Returns true if the url has a protocol of 'git:', 'git+http:', 'git+https:', 'git+rsync:', 'git+ftp:', 'git+ssh:' or path ending in '.git'.

Returns false otherwise.

isGistUrl(url)

Returns true if the url is a gist.github.com url, otherwise false.

isGitHubUrl(url)

Returns true if the url is a github.com url, otherwise false.

License

MIT

FAQs

Package last updated on 06 Oct 2013

Did you know?

Socket

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