# is-github-url

> Check if a passed string is a valid GitHub URL

Latest version **1.2.2** (published 2016-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-github-url
pnpm add is-github-url
yarn add is-github-url
bun add is-github-url
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2016-01-21 |
| First published | 2015-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/is-github-url) |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Philipp Alferov |
| Maintainers | alferov |
| Keywords | gh, github, git, valid, url, string |

## Links

- npm: https://www.npmjs.com/package/is-github-url
- Repository: https://github.com/alferov/is-github-url
- Homepage: https://github.com/alferov/is-github-url#readme
- Issues: https://github.com/alferov/is-github-url/issues
- npm.io page: https://npm.io/package/is-github-url

## Alternatives

- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads
- [@oridune/validator](https://npm.io/package/@oridune/validator.md) — 16 weekly downloads

## Recent versions

- 1.2.2 (latest) — 2016-01-21
- 1.2.1 — 2015-12-30
- 1.2.0 — 2015-11-05
- 1.1.2 — 2015-10-22
- 1.1.1 — 2015-10-21
- 1.1.0 — 2015-10-21
- 1.0.2 — 2015-10-16
- 1.0.0 — 2015-10-15

## README

# is-github-url [![Build Status](https://travis-ci.org/alferov/is-github-url.svg?branch=master)](https://travis-ci.org/alferov/is-github-url)

>  Check if a passed string is a valid GitHub URL

Unlike [is-git-url](https://github.com/jonschlinkert/is-git-url), is-github-url is a domain-specific validator. It returns `true` if passed URL is a part of `github.com` domain only.

## Installation
```
$ npm install is-github-url --save
```

## Usage
```js
var isGithubUrl = require('is-github-url');

// Valid examples
isGithubUrl('https://github.com/facebook');
 // => true
isGithubUrl('https://github.com/facebook/react');
 // => true
isGithubUrl('https://github.com/facebook/react/releases/tag/v0.14.0');
// => true
isGithubUrl('git@github.com:facebook/react.git');
// => true
isGithubUrl('git://github.com/facebook/react.git#gh-pages');
// => true

// Invalid examples
isGithubUrl('https://google.com');
 // => false
isGithubUrl('unknown://github.com');
// => false
isGithubUrl('http://facebook.github.io/');
// => false

// Repository mode can be used to check whether a passed URL
// is a valid repository URL
isGithubUrl('https://github.com/facebook/react', { repository: true });
// => true
isGithubUrl('https://github.com/facebook', { repository: true });
// => false
isGithubUrl('https://github.com/facebook/react/releases/tag/v0.14.0', {
  repository: true
});
// => false

// Strict mode is used to validate URLs before cloning
// Strict mode turns on automatically if URL contains git protocol
isGithubUrl('https://github.com/facebook/react.git', { strict: true });
// => true
isGithubUrl('https://github.com/facebook/react', { strict: true });
// => false
```

## API
### `isGithubUrl(url, [options])`
Check if a passed string is a valid GitHub URL

#### Params
- **String** `url`: A string to be validated
- **Object** `options`: An object containing the following fields:
  - `strict` (Boolean): Match only URLs ending with .git
  - `repository` (Boolean): Match only valid GitHub repo URLs

## License
MIT © [Philipp Alferov](https://github.com/alferov)

---
_Source: https://npm.io/package/is-github-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
