Socket
Socket
Sign inDemoInstall

ssh-config

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssh-config - npm Package Compare versions

Comparing version 4.1.5 to 4.1.6

21

index.js

@@ -82,3 +82,3 @@ 'use strict'

/**
* find section by Host or Match
* find section by Host / Match or function
*/

@@ -96,13 +96,18 @@ find(opts = {}) {

/**
* Remove section
* Remove section by Host / Match or function
*/
remove(opts = {}) {
if (!(opts && ('Host' in opts || 'Match' in opts))) {
throw new Error('Can only remove by Host or Match')
}
let index;
const index = typeof opts === 'function'
? super.findIndex(opts)
: super.findIndex(line => compare(line, opts))
if (typeof opts === 'function') {
index = super.findIndex(opts);
} else if (!(opts && ('Host' in opts || 'Match' in opts))) {
throw new Error('Can only remove by Host or Match');
} else {
index = super.findIndex(line => compare(line, opts));
}
if (index >= 0) return this.splice(index, 1)

@@ -109,0 +114,0 @@ }

{
"name": "ssh-config",
"description": "SSH config parser and stringifier",
"version": "4.1.5",
"version": "4.1.6",
"author": "Chen Yangjian (https://www.cyj.me)",

@@ -6,0 +6,0 @@ "repository": {

@@ -111,3 +111,3 @@ # SSH Config Parser & Stringifier

### `.remove` sections by Host or other criteria
### `.remove` sections by Host / Match or function

@@ -118,2 +118,4 @@ To remove sections, we can pass the section to `.remove(opts)`.

config.remove({ Host: 'example1' })
// or the ES2015 Array.prototype.find
config.remove(line => line.param == 'Host' && line.value == 'example1')
```

@@ -120,0 +122,0 @@

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