Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-ssh

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-ssh - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

106

example/index.js
// Dependencies
var IsSsh = require("../lib");
const isSsh = require("../lib");
// 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:port/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@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:port/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://host.xz/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@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://host.xz/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@host.xz/~user/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://host.xz/~user/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@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://host.xz/~/path/to/repo.git"));
// true
console.log(IsSsh("user@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:~user/path/to/repo.git/"));
// true
console.log(IsSsh("user@host.xz: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: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("host.xz:~user/path/to/repo.git/"));
// true
console.log(IsSsh("rsync://host.xz/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/path/to/repo.git/"));
// false
console.log(IsSsh("git://host.xz/~user/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("http://host.xz/path/to/repo.git/"));
// false
console.log(IsSsh("https://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("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
console.log(IsSsh("file://~/path/to/repo.git/"));
// => false
console.log(isSsh("file://~/path/to/repo.git/"));
// false
// Dependencies
var Protocols = require("protocols");
const protocols = require("protocols");
/**
* IsSsh
* isSsh
* Checks if an input value is a ssh url or not.
*
* @name IsSsh
* @name isSsh
* @function

@@ -13,3 +13,3 @@ * @param {String|Array} input The input url or an array of protocols.

*/
function IsSsh(input) {
function isSsh(input) {

@@ -24,5 +24,5 @@ if (Array.isArray(input)) {

var protocols = Protocols(input);
var prots = protocols(input);
input = input.substring(input.indexOf("://") + 3);
if (IsSsh(protocols)) {
if (isSsh(prots)) {
return true;

@@ -35,2 +35,2 @@ }

module.exports = IsSsh;
module.exports = isSsh;
{
"name": "is-ssh",
"version": "1.2.1",
"version": "1.3.0",
"description": "Check if an input value is a ssh url or not.",

@@ -11,3 +11,3 @@ "main": "lib/index.js",

"scripts": {
"test": "mocha test"
"test": "node test"
},

@@ -34,4 +34,4 @@ "repository": {

"devDependencies": {
"mocha": "^2.2.5"
"tester": "^1.3.1"
}
}

@@ -15,85 +15,85 @@ # is-ssh [![PayPal](https://img.shields.io/badge/%24-paypal-f39c12.svg)][paypal-donations] [![Version](https://img.shields.io/npm/v/is-ssh.svg)](https://www.npmjs.com/package/is-ssh) [![Downloads](https://img.shields.io/npm/dt/is-ssh.svg)](https://www.npmjs.com/package/is-ssh) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)

// Dependencies
var IsSsh = require("is-ssh");
const 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:port/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@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:port/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://host.xz/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@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://host.xz/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@host.xz/~user/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://host.xz/~user/path/to/repo.git/"));
// true
console.log(IsSsh("ssh://user@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://host.xz/~/path/to/repo.git"));
// true
console.log(IsSsh("user@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:~user/path/to/repo.git/"));
// true
console.log(IsSsh("user@host.xz: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: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("host.xz:~user/path/to/repo.git/"));
// true
console.log(IsSsh("rsync://host.xz/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/path/to/repo.git/"));
// false
console.log(IsSsh("git://host.xz/~user/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("http://host.xz/path/to/repo.git/"));
// false
console.log(IsSsh("https://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("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
console.log(IsSsh("file://~/path/to/repo.git/"));
// => false
console.log(isSsh("file://~/path/to/repo.git/"));
// false
```

@@ -103,3 +103,3 @@

### `IsSsh(input)`
### `isSsh(input)`
Checks if an input value is a ssh url or not.

@@ -106,0 +106,0 @@

// Dependencies
var IsSsh = require("../lib")
, Assert = require("assert")
;
const isSsh = require("../lib")
, tester = require("tester")
;

@@ -43,8 +43,9 @@ // Prepare the input data

// Run the tests
input.forEach(function (c) {
it(c[0] + " is supposed " + (!c[1] ? "not " : "") + "to be a ssh url", function (cb) {
Assert.equal(IsSsh(c[0]), c[1]);
cb();
tester.describe("check urls", test => {
// Run the tests
input.forEach(c => {
test.it(c[0] + " is supposed " + (!c[1] ? "not " : "") + "to be a ssh url", () => {
test.expect(isSsh(c[0])).toBe(c[1]);
});
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc