ssh-config
Advanced tools
Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3
@@ -7,2 +7,3 @@ 2.0.0 / 2019-06-?? | ||
* Fix: quoted values can contain double quotes once they are escaped with backslash | ||
* Fix: escape + when converting patterns to regexp | ||
@@ -9,0 +10,0 @@ |
@@ -13,3 +13,3 @@ 'use strict' | ||
function match(line, opts) { | ||
function compare(line, opts) { | ||
return opts.hasOwnProperty(line.param) && opts[line.param] === line.value | ||
@@ -68,3 +68,3 @@ } | ||
return super.find(line => match(line, opts)) | ||
return super.find(line => compare(line, opts)) | ||
} | ||
@@ -82,3 +82,3 @@ | ||
? super.findIndex(opts) | ||
: super.findIndex(line => match(line, opts)) | ||
: super.findIndex(line => compare(line, opts)) | ||
@@ -85,0 +85,0 @@ if (index >= 0) return this.splice(index, 1) |
{ | ||
"name": "ssh-config", | ||
"description": "SSH config parser and stringifier", | ||
"version": "2.0.0-alpha.2", | ||
"version": "2.0.0-alpha.3", | ||
"author": "Chen Yangjian (https://www.cyj.me)", | ||
@@ -6,0 +6,0 @@ "repository": { |
'use strict' | ||
function match(pattern, str) { | ||
pattern = pattern.replace(/\./g, '\\.') | ||
pattern = pattern | ||
.replace(/\./g, '\\.') | ||
.replace(/\+/g, '\\+') | ||
.replace(/\*/g, '.*') | ||
@@ -19,3 +21,3 @@ .replace(/\?/g, '.?') | ||
function glob(patternList, str) { | ||
const patterns = Array.isArray(patternList) ? patternList : patternList.split(/[,\s]+/) | ||
const patterns = Array.isArray(patternList) ? patternList : patternList.split(/,/) | ||
@@ -30,2 +32,3 @@ // > If a negated entry is matched, then the Host entry is ignored, regardless of whether any other patterns on the line match. | ||
} else if (match(pattern, str)) { | ||
// wait until all of the pattern match results because there might be a negated pattern | ||
result = true | ||
@@ -32,0 +35,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17713
349