Socket
Socket
Sign inDemoInstall

@pushrocks/smartmatch

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.7 to 2.0.0

dist_ts/00_commitinfo_data.d.ts

211

dist_bundle/bundle.js

@@ -1,106 +0,115 @@

var tsbundle = (function (exports) {
'use strict';
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var escapeStringRegexp = string => {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
}
// node_modules/matcher/index.js
var matcher_exports = {};
__export(matcher_exports, {
isMatch: () => isMatch,
matcher: () => matcher
});
// Escape characters with special meaning either inside or outside character sets.
// Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
return string
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
.replace(/-/g, '\\x2d');
};
// node_modules/matcher/node_modules/escape-string-regexp/index.js
function escapeStringRegexp(string) {
if (typeof string !== "string") {
throw new TypeError("Expected a string");
}
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
}
const regexpCache = new Map();
// node_modules/matcher/index.js
var regexpCache = /* @__PURE__ */ new Map();
var sanitizeArray = (input, inputName) => {
if (!Array.isArray(input)) {
switch (typeof input) {
case "string":
input = [input];
break;
case "undefined":
input = [];
break;
default:
throw new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);
}
}
return input.filter((string) => {
if (typeof string !== "string") {
if (typeof string === "undefined") {
return false;
}
throw new TypeError(`Expected '${inputName}' to be an array of strings, but found a type of '${typeof string}' in the array`);
}
return true;
});
};
var makeRegexp = (pattern, options) => {
options = {
caseSensitive: false,
...options
};
const cacheKey = pattern + JSON.stringify(options);
if (regexpCache.has(cacheKey)) {
return regexpCache.get(cacheKey);
}
const negated = pattern[0] === "!";
if (negated) {
pattern = pattern.slice(1);
}
pattern = escapeStringRegexp(pattern).replace(/\\\*/g, "[\\s\\S]*");
const regexp = new RegExp(`^${pattern}$`, options.caseSensitive ? "" : "i");
regexp.negated = negated;
regexpCache.set(cacheKey, regexp);
return regexp;
};
var baseMatcher = (inputs, patterns, options, firstMatchOnly) => {
inputs = sanitizeArray(inputs, "inputs");
patterns = sanitizeArray(patterns, "patterns");
if (patterns.length === 0) {
return [];
}
patterns = patterns.map((pattern) => makeRegexp(pattern, options));
const { allPatterns } = options || {};
const result = [];
for (const input of inputs) {
let matches;
const didFit = [...patterns].fill(false);
for (const [index, pattern] of patterns.entries()) {
if (pattern.test(input)) {
didFit[index] = true;
matches = !pattern.negated;
if (!matches) {
break;
}
}
}
if (!(matches === false || matches === void 0 && patterns.some((pattern) => !pattern.negated) || allPatterns && didFit.some((yes, index) => !yes && !patterns[index].negated))) {
result.push(input);
if (firstMatchOnly) {
break;
}
}
}
return result;
};
function matcher(inputs, patterns, options) {
return baseMatcher(inputs, patterns, options, false);
}
function isMatch(inputs, patterns, options) {
return baseMatcher(inputs, patterns, options, true).length > 0;
}
function makeRegexp(pattern, options) {
options = {
caseSensitive: false,
...options
};
const cacheKey = pattern + JSON.stringify(options);
if (regexpCache.has(cacheKey)) {
return regexpCache.get(cacheKey);
}
const negated = pattern[0] === '!';
if (negated) {
pattern = pattern.slice(1);
}
pattern = escapeStringRegexp(pattern).replace(/\\\*/g, '[\\s\\S]*');
const regexp = new RegExp(`^${pattern}$`, options.caseSensitive ? '' : 'i');
regexp.negated = negated;
regexpCache.set(cacheKey, regexp);
return regexp;
}
var matcher = (inputs, patterns, options) => {
if (!(Array.isArray(inputs) && Array.isArray(patterns))) {
throw new TypeError(`Expected two arrays, got ${typeof inputs} ${typeof patterns}`);
}
if (patterns.length === 0) {
return inputs;
}
const isFirstPatternNegated = patterns[0][0] === '!';
patterns = patterns.map(pattern => makeRegexp(pattern, options));
const result = [];
for (const input of inputs) {
// If first pattern is negated we include everything to match user expectation.
let matches = isFirstPatternNegated;
for (const pattern of patterns) {
if (pattern.test(input)) {
matches = !pattern.negated;
}
}
if (matches) {
result.push(input);
}
}
return result;
};
var isMatch = (input, pattern, options) => {
const inputArray = Array.isArray(input) ? input : [input];
const patternArray = Array.isArray(pattern) ? pattern : [pattern];
return inputArray.some(input => {
return patternArray.every(pattern => {
const regexp = makeRegexp(pattern, options);
const matches = regexp.test(input);
return regexp.negated ? !matches : matches;
});
});
};
matcher.isMatch = isMatch;
class SmartMatch {
constructor(wildcardArg) {
this.wildcard = wildcardArg;
}
match(matchStringArg) {
return matcher.isMatch(matchStringArg, this.wildcard);
}
}
exports.SmartMatch = SmartMatch;
return exports;
}({}));
// ts/index.ts
var SmartMatch = class {
constructor(wildcardArg) {
this.wildcard = wildcardArg;
}
match(matchStringArg) {
return matcher_exports.isMatch(matchStringArg, this.wildcard);
}
};
export {
SmartMatch
};
//# sourceMappingURL=bundle.js.map

@@ -1,12 +0,3 @@

"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./smartmatch.plugins"));
class SmartMatch {
import * as plugins from './smartmatch.plugins.js';
export class SmartMatch {
constructor(wildcardArg) {

@@ -19,3 +10,2 @@ this.wildcard = wildcardArg;

}
exports.SmartMatch = SmartMatch;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSw4REFBZ0Q7QUFFaEQsTUFBYSxVQUFVO0lBRXJCLFlBQVksV0FBbUI7UUFDN0IsSUFBSSxDQUFDLFFBQVEsR0FBRyxXQUFXLENBQUM7SUFDOUIsQ0FBQztJQUVNLEtBQUssQ0FBQyxjQUFzQjtRQUNqQyxPQUFPLE9BQU8sQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDaEUsQ0FBQztDQUNGO0FBVEQsZ0NBU0MifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHlCQUF5QixDQUFDO0FBRW5ELE1BQU0sT0FBTyxVQUFVO0lBRXJCLFlBQVksV0FBbUI7UUFDN0IsSUFBSSxDQUFDLFFBQVEsR0FBRyxXQUFXLENBQUM7SUFDOUIsQ0FBQztJQUVNLEtBQUssQ0FBQyxjQUFzQjtRQUNqQyxPQUFPLE9BQU8sQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDaEUsQ0FBQztDQUNGIn0=

@@ -1,2 +0,2 @@

import matcher from 'matcher';
import * as matcher from 'matcher';
export { matcher };

@@ -1,9 +0,4 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// third party scope
const matcher_1 = __importDefault(require("matcher"));
exports.matcher = matcher_1.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRtYXRjaC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRtYXRjaC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsb0JBQW9CO0FBQ3BCLHNEQUE4QjtBQUVyQixrQkFGRixpQkFBTyxDQUVFIn0=
import * as matcher from 'matcher';
export { matcher };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRtYXRjaC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRtYXRjaC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFvQjtBQUNwQixPQUFPLEtBQUssT0FBTyxNQUFNLFNBQVMsQ0FBQztBQUVuQyxPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUMifQ==

@@ -8,3 +8,3 @@ {

"gitrepo": "smartmatch",
"shortDescription": "a minimal matching library using picomatch",
"description": "a minimal matching library using picomatch",
"npmPackagename": "@pushrocks/smartmatch",

@@ -11,0 +11,0 @@ "license": "MIT",

{
"name": "@pushrocks/smartmatch",
"version": "1.0.7",
"version": "2.0.0",
"private": false,

@@ -8,2 +8,3 @@ "description": "a minimal matching library using picomatch",

"typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH",

@@ -14,15 +15,14 @@ "license": "MIT",

"build": "(tsbuild && tsbundle npm)",
"format": "(gitzone format)"
"format": "(gitzone format)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsbundle": "^1.0.68",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.2.1",
"@types/node": "^14.0.5",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.15.0"
"@gitzone/tsbuild": "^2.1.65",
"@gitzone/tsbundle": "^2.0.7",
"@gitzone/tstest": "^1.0.73",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.6.5"
},
"dependencies": {
"matcher": "^3.0.0"
"matcher": "^5.0.0"
},

@@ -40,3 +40,6 @@ "files": [

"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

@@ -11,10 +11,17 @@ # @pushrocks/smartmatch

## Status for master
[![pipeline status](https://gitlab.com/pushrocks/smartmatch/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartmatch/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartmatch/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartmatch/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartmatch.svg)](https://www.npmjs.com/package/@pushrocks/smartmatch)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartmatch/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartmatch)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartmatch/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartmatch/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartmatch)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartmatch)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartmatch)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartmatch)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartmatch)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage

@@ -21,0 +28,0 @@

@@ -1,2 +0,2 @@

import * as plugins from './smartmatch.plugins';
import * as plugins from './smartmatch.plugins.js';

@@ -3,0 +3,0 @@ export class SmartMatch {

// third party scope
import matcher from 'matcher';
import * as matcher from 'matcher';
export { matcher };

Sorry, the diff of this file is not supported yet

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