Socket
Socket
Sign inDemoInstall

wildcard

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

2

component.json

@@ -5,3 +5,3 @@ {

"description": "Wildcard matching tools",
"version": "1.1.0",
"version": "1.1.1",
"keywords": [

@@ -8,0 +8,0 @@ "wildcard",

@@ -32,4 +32,6 @@ /* jshint node: true */

function WildcardMatcher(text, separator) {
this.text = text = text || '';
this.hasWild = ~text.indexOf('*');
this.separator = separator;
this.parts = (text || '').split(separator);
this.parts = text.split(separator);
}

@@ -45,8 +47,19 @@

if (typeof input == 'string' || input instanceof String) {
testParts = (input || '').split(this.separator);
for (ii = 0; matches && ii < partsCount; ii++) {
matches = parts[ii] === '*' || parts[ii] === testParts[ii];
if (!this.hasWild && this.text != input) {
matches = false;
} else {
testParts = (input || '').split(this.separator);
for (ii = 0; matches && ii < partsCount; ii++) {
if (parts[ii] === '*') {
continue;
} else if (ii < testParts.length) {
matches = parts[ii] === testParts[ii];
} else {
matches = false;
}
}
// If matches, then return the component parts
matches = matches && testParts;
}
// If matches, then return the component parts
matches = matches && testParts;
}

@@ -53,0 +66,0 @@ else if (typeof input.splice == 'function') {

@@ -9,3 +9,3 @@ {

],
"version": "1.1.0",
"version": "1.1.1",
"dependencies": {},

@@ -12,0 +12,0 @@ "devDependencies": {

@@ -6,3 +6,3 @@ var test = require('tape'),

t.plan(5);
t.plan(6);
t.ok(wildcard('foo.*', 'foo.bar'), 'foo.* should match foo.bar');

@@ -13,2 +13,3 @@ t.ok(wildcard('foo.*', 'foo'), 'foo.* should match foo');

t.notOk(wildcard('a.*.c', 'a.b'), 'a.*.c should not match a.b');
t.notOk(wildcard('a', 'a.b.c'), 'a should not match a.b.c');
});

@@ -15,0 +16,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc