docs: add quixzoom-auth-core product to AAMOS
- Product documentation in docs/products/ - Updated MEMORY.md with product info - quiXzoom Auth Core as AAMOS Identity product
This commit is contained in:
+109
@@ -0,0 +1,109 @@
|
||||
declare namespace matcher {
|
||||
interface Options {
|
||||
/**
|
||||
Treat uppercase and lowercase characters as being the same.
|
||||
|
||||
Ensure you use this correctly. For example, files and directories should be matched case-insensitively, while most often, object keys should be matched case-sensitively.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly caseSensitive?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const matcher: {
|
||||
/**
|
||||
It matches even across newlines. For example, `foo*r` will match `foo\nbar`.
|
||||
|
||||
@param inputs - String or array of strings to match.
|
||||
@param patterns - String or array of string patterns. Use `*` to match zero or more characters. A pattern starting with `!` will be negated.
|
||||
@returns Whether any given `input` matches every given `pattern`.
|
||||
|
||||
@example
|
||||
```
|
||||
import matcher = require('matcher');
|
||||
|
||||
matcher.isMatch('unicorn', 'uni*');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', '*corn');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', 'un*rn');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('rainbow', '!unicorn');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('foo bar baz', 'foo b* b*');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', 'uni\\*');
|
||||
//=> false
|
||||
|
||||
matcher.isMatch('UNICORN', 'UNI*', {caseSensitive: true});
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('UNICORN', 'unicorn', {caseSensitive: true});
|
||||
//=> false
|
||||
|
||||
matcher.isMatch(['foo', 'bar'], 'f*');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch(['foo', 'bar'], ['a*', 'b*']);
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', ['tri*', 'UNI*'], {caseSensitive: true});
|
||||
//=> false
|
||||
|
||||
matcher.isMatch('unicorn', ['']);
|
||||
//=> false
|
||||
|
||||
matcher.isMatch('unicorn', []);
|
||||
//=> false
|
||||
|
||||
matcher.isMatch([], 'bar');
|
||||
//=> false
|
||||
|
||||
matcher.isMatch([], []);
|
||||
//=> false
|
||||
|
||||
matcher.isMatch([''], ['']);
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
isMatch: (inputs: string | readonly string[], patterns: string | readonly string[], options?: matcher.Options) => boolean;
|
||||
|
||||
/**
|
||||
Simple [wildcard](https://en.wikipedia.org/wiki/Wildcard_character) matching.
|
||||
|
||||
It matches even across newlines. For example, `foo*r` will match `foo\nbar`.
|
||||
|
||||
@param inputs - String or array of strings to match.
|
||||
@param patterns - String or array of string patterns. Use `*` to match zero or more characters. A pattern starting with `!` will be negated.
|
||||
@returns The `inputs` filtered based on the `patterns`.
|
||||
|
||||
@example
|
||||
```
|
||||
import matcher = require('matcher');
|
||||
|
||||
matcher(['foo', 'bar', 'moo'], ['*oo', '!foo']);
|
||||
//=> ['moo']
|
||||
|
||||
matcher(['foo', 'bar', 'moo'], ['!*oo']);
|
||||
//=> ['bar']
|
||||
|
||||
matcher('moo', ['']);
|
||||
//=> []
|
||||
|
||||
matcher('moo', []);
|
||||
//=> []
|
||||
|
||||
matcher([''], ['']);
|
||||
//=> ['']
|
||||
```
|
||||
*/
|
||||
(inputs: string | readonly string[], patterns: string | readonly string[], options?: matcher.Options): string[];
|
||||
};
|
||||
|
||||
export = matcher;
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
'use strict';
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
const regexpCache = new Map();
|
||||
|
||||
function 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;
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
module.exports = (inputs, patterns, options) => {
|
||||
inputs = sanitizeArray(inputs, 'inputs');
|
||||
patterns = sanitizeArray(patterns, 'patterns');
|
||||
|
||||
if (patterns.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
module.exports.isMatch = (inputs, patterns, options) => {
|
||||
inputs = sanitizeArray(inputs, 'inputs');
|
||||
patterns = sanitizeArray(patterns, 'patterns');
|
||||
|
||||
if (patterns.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return inputs.some(input => {
|
||||
return patterns.every(pattern => {
|
||||
const regexp = makeRegexp(pattern, options);
|
||||
const matches = regexp.test(input);
|
||||
return regexp.negated ? !matches : matches;
|
||||
});
|
||||
});
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "matcher",
|
||||
"version": "4.0.0",
|
||||
"description": "Simple wildcard matching",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/matcher",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"bench": "matcha bench.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"matcher",
|
||||
"matching",
|
||||
"match",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular",
|
||||
"expression",
|
||||
"wildcard",
|
||||
"pattern",
|
||||
"string",
|
||||
"filter",
|
||||
"glob",
|
||||
"globber",
|
||||
"globbing",
|
||||
"minimatch"
|
||||
],
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"matcha": "^0.7.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
# matcher
|
||||
|
||||
> Simple [wildcard](https://en.wikipedia.org/wiki/Wildcard_character) matching
|
||||
|
||||
Useful when you want to accept loose string input and regexes/globs are too convoluted.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install matcher
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const matcher = require('matcher');
|
||||
|
||||
matcher(['foo', 'bar', 'moo'], ['*oo', '!foo']);
|
||||
//=> ['moo']
|
||||
|
||||
matcher(['foo', 'bar', 'moo'], ['!*oo']);
|
||||
//=> ['bar']
|
||||
|
||||
matcher('moo', ['']);
|
||||
//=> []
|
||||
|
||||
matcher('moo', []);
|
||||
//=> []
|
||||
|
||||
matcher([''], ['']);
|
||||
//=> ['']
|
||||
|
||||
matcher.isMatch('unicorn', 'uni*');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', '*corn');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', 'un*rn');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('rainbow', '!unicorn');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('foo bar baz', 'foo b* b*');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', 'uni\\*');
|
||||
//=> false
|
||||
|
||||
matcher.isMatch('UNICORN', 'UNI*', {caseSensitive: true});
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('UNICORN', 'unicorn', {caseSensitive: true});
|
||||
//=> false
|
||||
|
||||
matcher.isMatch(['foo', 'bar'], 'f*');
|
||||
//=> true
|
||||
|
||||
matcher.isMatch(['foo', 'bar'], ['a*', 'b*']);
|
||||
//=> true
|
||||
|
||||
matcher.isMatch('unicorn', ['tri*', 'UNI*'], {caseSensitive: true});
|
||||
//=> false
|
||||
|
||||
matcher.isMatch('unicorn', ['']);
|
||||
//=> false
|
||||
|
||||
matcher.isMatch('unicorn', []);
|
||||
//=> false
|
||||
|
||||
matcher.isMatch([], 'bar');
|
||||
//=> false
|
||||
|
||||
matcher.isMatch([], []);
|
||||
//=> false
|
||||
|
||||
matcher.isMatch('', '');
|
||||
//=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
It matches even across newlines. For example, `foo*r` will match `foo\nbar`.
|
||||
|
||||
### matcher(inputs, patterns, options?)
|
||||
|
||||
Accepts a string or an array of strings for both `inputs` and `patterns`.
|
||||
|
||||
Returns an array of `inputs` filtered based on the `patterns`.
|
||||
|
||||
### matcher.isMatch(input, pattern, options?)
|
||||
|
||||
Accepts a string or an array of strings for both `inputs` and `patterns`.
|
||||
|
||||
Returns a `boolean` of whether any given `input` matches every given `pattern`.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string | string[]`
|
||||
|
||||
String or array of strings to match.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### caseSensitive
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Treat uppercase and lowercase characters as being the same.
|
||||
|
||||
Ensure you use this correctly. For example, files and directories should be matched case-insensitively, while most often, object keys should be matched case-sensitively.
|
||||
|
||||
#### pattern
|
||||
|
||||
Type: `string | string[]`
|
||||
|
||||
Use `*` to match zero or more characters. A pattern starting with `!` will be negated.
|
||||
|
||||
## Benchmark
|
||||
|
||||
```
|
||||
$ npm run bench
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [matcher-cli](https://github.com/sindresorhus/matcher-cli) - CLI for this module
|
||||
- [multimatch](https://github.com/sindresorhus/multimatch) - Extends `minimatch.match()` with support for multiple patterns
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-matcher?utm_source=npm-matcher&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
Reference in New Issue
Block a user