1.0.3 • Published 8 years ago

@maboiteaspam/ssh-host-parse v1.0.3

Weekly downloads
-
License
WTF
Repository
-
Last release
8 years ago

ssh-host-parse

parse ssh host like user@host:port

Install

npm i @maboiteaspam/ssh-host-parse --save-dev

Usage

var hParse = require('@maboiteaspam/ssh-host-parse');

console.log( hParse('some@where') )         // { host: 'where', port: 22, username: 'some' }

console.log( hParse('some@where:15251') )   // { host: 'where', port: 15251, username: 'some' }

console.log( hParse('where:15251') )        // { host: 'where', port: 15251, username: 'root' }

console.log( hParse('else') )               // { host: 'else', port: 22, username: 'root' }

Notes

I have only pulled out the code from sequest, https://github.com/mikeal/sequest/blob/master/index.js#L9

More