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

connexion-string

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connexion-string - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

19

index.js

@@ -67,2 +67,21 @@ function ConnString(defaults) {

ConnString.prototype.stringify = function(serverObj) {
var serverStr
if(serverObj) {
serverStr = serverObj.host
if(serverObj.port || this._defaults.port) {
serverStr += ':' + serverObj.port
}
if(serverObj.user) {
var credentials = serverObj.user
if(serverObj.password) {
credentials += ':' + serverObj.password
}
serverStr = credentials + '@' + serverStr
}
}
return serverStr
}
module.exports = ConnString

2

package.json
{
"name": "connexion-string",
"version": "0.1.1",
"version": "0.1.2",
"description": "servers connexion string (de)serialization",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -56,2 +56,46 @@

})
describe('serialize', function() {
it('host', function() {
var expectedStr = '127.0.0.1'
var server = connStr.parse(expectedStr)
var actualStr = connStr.stringify(server)
assert.ok(actualStr)
assert.equal(actualStr, 'user@127.0.0.1:22')
})
it('user@host', function() {
var expectedStr = 'myName@127.0.0.1'
var server = connStr.parse(expectedStr)
var actualStr = connStr.stringify(server)
assert.ok(actualStr)
assert.equal(actualStr, 'myName@127.0.0.1:22')
})
it('user@host:port', function() {
var expectedStr = 'myName@127.0.0.1:2222'
var server = connStr.parse(expectedStr)
var actualStr = connStr.stringify(server)
assert.ok(actualStr)
assert.equal(actualStr, expectedStr)
})
it('user:pwd@host:port', function() {
var expectedStr = 'myName:123456@127.0.0.1:2222'
var server = connStr.parse(expectedStr)
var actualStr = connStr.stringify(server)
assert.ok(actualStr)
assert.equal(actualStr, expectedStr)
})
})
})
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