update tsconfig
This commit is contained in:
parent
5e8b5b0040
commit
0a692bcaa3
@ -5,17 +5,26 @@
|
|||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartmatch",
|
"gitrepo": "smartmatch",
|
||||||
"description": "a minimal matching library using picomatch",
|
"description": "A minimal matching library using picomatch for string matching based on wildcards.",
|
||||||
"npmPackagename": "@push.rocks/smartmatch",
|
"npmPackagename": "@push.rocks/smartmatch",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "push.rocks"
|
"projectDomain": "push.rocks",
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"picomatch",
|
||||||
|
"matching library",
|
||||||
|
"string matching",
|
||||||
|
"wildcards",
|
||||||
|
"typescript",
|
||||||
|
"npm package"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
},
|
},
|
||||||
"tsdocs": {
|
"tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
11
package.json
11
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@push.rocks/smartmatch",
|
"name": "@push.rocks/smartmatch",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a minimal matching library using picomatch",
|
"description": "A minimal matching library using picomatch for string matching based on wildcards.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -38,5 +38,14 @@
|
|||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"picomatch",
|
||||||
|
"matching library",
|
||||||
|
"string matching",
|
||||||
|
"wildcards",
|
||||||
|
"typescript",
|
||||||
|
"npm package"
|
||||||
]
|
]
|
||||||
}
|
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
120
readme.md
120
readme.md
@ -1,39 +1,105 @@
|
|||||||
# @pushrocks/smartmatch
|
# @push.rocks/smartmatch
|
||||||
a minimal matching library using picomatch
|
a minimal matching library using picomatch
|
||||||
|
|
||||||
## Availabililty and Links
|
## Install
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartmatch)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartmatch)
|
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartmatch)
|
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartmatch/)
|
|
||||||
|
|
||||||
## Status for master
|
To install `@push.rocks/smartmatch`, you'll need Node.js and npm installed on your development machine. If you have those set up, installing `@push.rocks/smartmatch` is as simple as running the following command in your terminal:
|
||||||
|
|
||||||
Status Category | Status Badge
|
```bash
|
||||||
-- | --
|
npm install @push.rocks/smartmatch --save
|
||||||
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)
|
This will add `@push.rocks/smartmatch` to your project's dependencies and you're ready to start using it in your application.
|
||||||
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
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class intellisense
|
Using `@push.rocks/smartmatch` is straightforward. The library is designed to provide a minimal yet powerful matching functionality leveraging the `picomatch` library. The core functionality revolves around matching strings against a provided wildcard pattern. It’s especially useful for scenarios where there’s a need to filter names, file paths, or any strings based on wildcard patterns (similar to the glob patterns).
|
||||||
|
|
||||||
## Contribution
|
### Getting Started with @push.rocks/smartmatch
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
Firstly, ensure that you import `@push.rocks/smartmatch` into your project:
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
```typescript
|
||||||
|
import { SmartMatch } from '@push.rocks/smartmatch';
|
||||||
|
```
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
### Creating a Matcher Instance
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
|
||||||
|
|
||||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
The `SmartMatch` class is the entry point to the library's functionality. You create an instance of `SmartMatch` by providing a wildcard pattern to its constructor. This pattern will be used for matching against the strings.
|
||||||
|
|
||||||
|
Here’s an example:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const myMatcher = new SmartMatch('*.ts');
|
||||||
|
```
|
||||||
|
|
||||||
|
This matcher will be used to determine if a given string matches the wildcard pattern `*.ts`, meaning it should end with `.ts`.
|
||||||
|
|
||||||
|
### Matching Strings
|
||||||
|
|
||||||
|
To match a string against the pattern, use the `match` method on your `SmartMatch` instance. This method takes a string as an argument and returns a boolean indicating whether the string matches the pattern.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Assuming myMatcher is instantiated with '*.ts' as shown above.
|
||||||
|
|
||||||
|
const fileName = 'example.ts';
|
||||||
|
|
||||||
|
if (myMatcher.match(fileName)) {
|
||||||
|
console.log(`${fileName} matches the pattern!`);
|
||||||
|
} else {
|
||||||
|
console.log(`${fileName} does not match the pattern.`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Advanced Use Cases
|
||||||
|
|
||||||
|
`@push.rocks/smartmatch` is designed to be minimal, but you can create multiple instances of `SmartMatch` with different patterns to support more complex matching logic in your application. This is particularly useful for applications that deal with various types of files, names, or identifiers that follow different naming conventions.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const scriptMatcher = new SmartMatch('*.js');
|
||||||
|
const typeScriptMatcher = new SmartMatch('*.ts');
|
||||||
|
|
||||||
|
const checkFileType = (fileName: string) => {
|
||||||
|
if (scriptMatcher.match(fileName)) {
|
||||||
|
console.log(`${fileName} is a JavaScript file.`);
|
||||||
|
} else if (typeScriptMatcher.match(fileName)) {
|
||||||
|
console.log(`${fileName} is a TypeScript file.`);
|
||||||
|
} else {
|
||||||
|
console.log(`${fileName} is of an unknown type.`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Test the function
|
||||||
|
checkFileType('test.js'); // Output: test.js is a JavaScript file.
|
||||||
|
checkFileType('module.ts'); // Output: module.ts is a TypeScript file.
|
||||||
|
checkFileType('image.png'); // Output: image.png is of an unknown type.
|
||||||
|
```
|
||||||
|
|
||||||
|
This makes `@push.rocks/smartmatch` a versatile library suitable for various applications that require simple yet efficient matching logic.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
`@push.rocks/smartmatch` offers an elegant solution for matching strings against wildcard patterns. Whether you are developing a file utility tool, a project management app, or any software that needs to filter or categorize data based on naming patterns, `@push.rocks/smartmatch` could be the library you need. Its simplicity and effectiveness make it a valuable tool for developers looking for a minimal matching library.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||||
|
Loading…
Reference in New Issue
Block a user