update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:31:59 +02:00
parent 8f072ad217
commit 13ca1037d2
4 changed files with 140 additions and 30 deletions

View File

@ -5,17 +5,30 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartvalidator",
"description": "a wrapper for the validator package to perform validations",
"description": "A wrapper for performing validations using the validator package.",
"npmPackagename": "@push.rocks/smartvalidator",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"keywords": [
"validation",
"validator wrapper",
"data sanitation",
"input validation",
"type checking",
"security",
"form validation",
"string validation",
"URL validation",
"IBAN validation",
"email escape"
]
}
},
"npmci": {
"npmGlobalTools": [],
"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"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartvalidator",
"version": "1.0.5",
"private": false,
"description": "a wrapper for the validator package to perform validations",
"description": "A wrapper for performing validations using the validator package.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -39,5 +39,18 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"keywords": [
"validation",
"validator wrapper",
"data sanitation",
"input validation",
"type checking",
"security",
"form validation",
"string validation",
"URL validation",
"IBAN validation",
"email escape"
]
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

135
readme.md
View File

@ -1,37 +1,120 @@
# @pushrocks/smartvalidator
# @push.rocks/smartvalidator
a wrapper for the validator package to perform validations
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartvalidator)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartvalidator)
* [github.com (source mirror)](https://github.com/pushrocks/smartvalidator)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartvalidator/)
## Install
To use `@push.rocks/smartvalidator` in your project, installation via npm or yarn is straightforward. Run the following command in your project directory:
## Status for master
```bash
npm install @push.rocks/smartvalidator --save
```
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartvalidator/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartvalidator/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartvalidator)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartvalidator)](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/smartvalidator)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartvalidator)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartvalidator)](https://lossless.cloud)
or if you prefer using yarn:
```bash
yarn add @push.rocks/smartvalidator
```
This will download the package and add it to your `node_modules` folder as well as list it as a dependency in your `package.json` file.
## Usage
Use TypeScript for best in class intellisense
`@push.rocks/smartvalidator` serves as a convenient wrapper around the popular [`validator`](https://www.npmjs.com/package/validator) library, providing you with additional utilities and simplifications for validation tasks. Below is a comprehensive guide on how to leverage `@push.rocks/smartvalidator` effectively in your TypeScript project.
## Contribution
First, ensure that your module system supports ECMAScript Modules (ESM) syntax and that you have TypeScript configured in your project.
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). :)
### Getting Started
To begin, import `SmartValidator` from the package:
For further information read the linked docs at the top of this readme.
```typescript
import { SmartValidator } from '@push.rocks/smartvalidator';
```
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
Create an instance of `SmartValidator`:
```typescript
const validator = new SmartValidator();
```
### Validating an IBAN
Validating an International Bank Account Number (IBAN) is straightforward:
```typescript
const iban = 'AT95 0100 0000 0555 4915';
if (validator.isIban(iban)) {
console.log('The IBAN is valid.');
} else {
console.log('The IBAN is invalid.');
}
```
### Checking URLs
To check if a string is a valid URL:
```typescript
const url = 'https://example.com';
if (validator.isUrl(url)) {
console.log('The URL is valid.');
} else {
console.log('The URL is invalid.');
}
```
### Escaping Strings
When you need to escape strings, for instance, to sanitize input data:
```typescript
const userInput = '<script>alert("xss")</script>';
const escapedInput = validator.escape(userInput);
console.log(escapedInput); // Output will have HTML special characters escaped
```
### Checking CSV Strings
You can check if a string could potentially be interpreted as CSV data:
```typescript
const csvString = 'name,age,city\nJohn Doe,29,New York';
if (validator.isCsv(csvString)) {
console.log('The string is likely a CSV data.');
} else {
console.log('The string is unlikely to be CSV data.');
}
```
### Underlying Validator Access
The underlying `validator` library can be accessed directly if you need functionalities not directly exposed by `SmartValidator`:
```typescript
const email = 'example@example.com';
if (SmartValidator.validator.isEmail(email)) {
console.log('The email address is valid.');
} else {
console.log('The email address is invalid.');
}
```
### Additional Notes
- Keep in mind that while `@push.rocks/smartvalidator` simplifies certain tasks, not all functionalities of the `validator` library are wrapped. Access the original validator object for advanced use cases.
- For contributions or issues, please refer to the project's GitHub repository.
**Note**: The usage examples shown above cover basic usage and common validation tasks. For more complex use cases, feel free to explore the original `validator` library's [documentation](https://www.npmjs.com/package/validator) as `@push.rocks/smartvalidator` simply extends its capabilities.
By integrating `@push.rocks/smartvalidator` into your project, you leverage a streamlined, typed interface for data validation, enhancing both development experience and code maintainability.
## 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.