JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4213416
  • Score
    100M100P100Q201444F
  • License MIT

Check if an input value is a ssh url or not.

Package Exports

  • is-ssh

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-ssh) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-ssh Support this project

Check if an input value is a ssh url or not.

Installation

$ npm i --save is-ssh

Example

// Dependencies
var IsSsh = require("is-ssh");

// Secure Shell Transport Protocol (SSH)
console.log(IsSsh("ssh://user@host.xz:port/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://user@host.xz/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://host.xz:port/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://host.xz/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://user@host.xz/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://host.xz/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://user@host.xz/~user/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://host.xz/~user/path/to/repo.git/"));
// => true

console.log(IsSsh("ssh://user@host.xz/~/path/to/repo.git"));
// => true

console.log(IsSsh("ssh://host.xz/~/path/to/repo.git"));
// => true

console.log(IsSsh("user@host.xz:/path/to/repo.git/"));
// => true

console.log(IsSsh("user@host.xz:~user/path/to/repo.git/"));
// => true

console.log(IsSsh("user@host.xz:path/to/repo.git"));
// => true

console.log(IsSsh("host.xz:/path/to/repo.git/"));
// => true

console.log(IsSsh("host.xz:path/to/repo.git"));
// => true

console.log(IsSsh("host.xz:~user/path/to/repo.git/"));
// => true

console.log(IsSsh("rsync://host.xz/path/to/repo.git/"));
// => true

// Git Transport Protocol
console.log(IsSsh("git://host.xz/path/to/repo.git/"));
// => false

console.log(IsSsh("git://host.xz/~user/path/to/repo.git/"));
// => false

// HTTP/S Transport Protocol
console.log(IsSsh("http://host.xz/path/to/repo.git/"));
// => false

console.log(IsSsh("https://host.xz/path/to/repo.git/"));
// => false

// Local (Filesystem) Transport Protocol
console.log(IsSsh("/path/to/repo.git/"));
// => false

console.log(IsSsh("path/to/repo.git/"));
// => false

console.log(IsSsh("~/path/to/repo.git"));
// => false

console.log(IsSsh("file:///path/to/repo.git/"));
// => false

console.log(IsSsh("file://~/path/to/repo.git/"));
// => false

Documentation

IsSsh(input)

Checks if an input value is a ssh url or not.

Params

  • String|Array input: The input url or an array of protocols.

Return

  • Boolean true if the input is a ssh url, false otherwise.

How to contribute

Have an idea? Found a bug? See how to contribute.

Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

License

MIT © Ionică Bizău