update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:26:18 +02:00
parent 871a22a801
commit 579e25fe5a
4 changed files with 165 additions and 64 deletions

View File

@ -14,12 +14,26 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartstring",
"description": "handle strings in smart ways. TypeScript ready.",
"description": "A library for handling strings in smart ways, including manipulation and encoding, with TypeScript support.",
"npmPackagename": "@push.rocks/smartstring",
"license": "MIT"
"license": "MIT",
"keywords": [
"string manipulation",
"encode",
"decode",
"base64",
"indentation",
"normalization",
"regex",
"random string",
"cryptographic string",
"domain parsing",
"git repository parsing",
"docker environment parsing"
]
}
},
"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/smartstring",
"version": "4.0.15",
"private": false,
"description": "handle strings in smart ways. TypeScript ready.",
"description": "A library for handling strings in smart ways, including manipulation and encoding, with TypeScript support.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -16,8 +16,18 @@
"url": "git+https://gitlab.com/push.rocks/smartstring.git"
},
"keywords": [
"string manipulation",
"encode",
"decode",
"base64",
"indentation",
"normalization",
"regex",
"string"
"random string",
"cryptographic string",
"domain parsing",
"git repository parsing",
"docker environment parsing"
],
"author": "Lossless GmbH",
"license": "MIT",
@ -57,4 +67,4 @@
"browserslist": [
"last 1 chrome versions"
]
}
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

192
readme.md
View File

@ -1,75 +1,151 @@
# @push.rocks/smartstring
handle strings in smart ways. TypeScript ready.
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartstring)
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartstring)
* [github.com (source mirror)](https://github.com/push.rocks/smartstring)
* [docs (typedoc)](https://push.rocks.gitlab.io/smartstring/)
## Install
To install `@push.rocks/smartstring`, use the following npm command:
## Status for master
```bash
npm install @push.rocks/smartstring --save
```
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartstring/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartstring/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartstring)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartstring)](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/@push.rocks/smartstring)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartstring)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartstring)](https://lossless.cloud)
This will add it to your project's dependencies.
## Usage
Use TypeScript for best in class instellisense.
The `@push.rocks/smartstring` package provides a powerful set of utilities to handle and manipulate strings in various ways, ready for TypeScript usage. Here's an exhaustive guide to using this package.
```javascript
import * as smartstring from 'smartstring';
### Working with Domain Strings
// classes
The `Domain` class helps in parsing and extracting information from domain URLs.
// smartstring.Domain class
let myDomain = new smartstring.Domain('https://sub.main.tld');
myDomain.level1; // "tld"
myDomain.level2; // "main"
// level3 , level 4 and so on...
myDomain.zoneName; // "main.tld"
myDOmain.protocol; // "https"
```typescript
import { Domain } from '@push.rocks/smartstring';
// smartstring.GitRepo class
let myGitRepo = new smartstring.GitRepo('git@github.com:someorg/somerepo.git'); // takes https and git and npm repo URL versions
myGitRepo.host; // "github.com"
myGitRepo.user; // "someorg"
myGitRepo.repo; // "somerepo"
myGitRepo.accessToken; // accessToken if specified with https
myGitRepo.sshUrl; // "git@github.com:someorg/somerepo.git" (computed also from https)
myGitRepo.httpsUrl; // "https://github.com/someorg/somerepo.git" (computed also from ssh)
//smartstring.Base64
let myBase64 = new smartstring.Base64('somestring', 'string'); // first arg is the string, second is string type (can be string, base64, base64uri)
myBase64.simpleString; // 'somestring'
myBase64.base64String; // base64 representation of 'somestring'
myBase64.base64UriString; // base64uri representation of 'sometring'
// methods
smartstring.base64.encode('somestring'); // encodes 'somestring' to base64
smartstring.base64.encodeUri('sometring'); // encodes 'somestring' to base64uri
smartstring.base64.decode(); // decodes base64 and base64uri to simple string respresentation
smartstring.indent.indent('somestringanotherstring', 4); // indents a string by 4
smartstring.indent.indent('somestringanotherstring', '>>>> '); // indents a string with a prefix
smartstring.indent.normalize(' somestring anotherstring', '>>>> '); // looks for the least amount of indention and removes superflouous space
// Parse a domain URL
const myDomain = new Domain('https://sub.example.com');
console.log(myDomain.level1); // Output: "com"
console.log(myDomain.level2); // Output: "example"
console.log(myDomain.zoneName); // Output: "example.com"
console.log(myDomain.protocol); // Output: "https"
```
## Contribution
### Handling Git Repositories
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). :)
The `GitRepo` class is designed for extracting information from Git repository URLs.
For further information read the linked docs at the top of this readme.
```typescript
import { GitRepo } from '@push.rocks/smartstring';
## 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)
// Parse a Git repository URL
const myGitRepo = new GitRepo('git@github.com:user/repo.git');
console.log(myGitRepo.host); // Output: "github.com"
console.log(myGitRepo.user); // Output: "user"
console.log(myGitRepo.repo); // Output: "repo"
console.log(myGitRepo.sshUrl); // Output: "git@github.com:user/repo.git"
console.log(myGitRepo.httpsUrl); // Output: "https://github.com/user/repo.git"
```
### Encoding and Decoding Base64 Strings
`@push.rocks/smartstring` offers base64 encoding and decoding through the `Base64` class and utility functions.
```typescript
import { Base64, base64 } from '@push.rocks/smartstring';
// Using the Base64 class
const myBase64 = new Base64('hello world', 'string');
console.log(myBase64.base64String); // Encoded string
console.log(myBase64.base64UriString); // Encoded URI compatible string
// Using utility functions
const encoded = base64.encode('hello world');
const decoded = base64.decode(encoded);
console.log(encoded); // Encoded string
console.log(decoded); // "hello world"
```
### Applying Indentation
SmartString allows you to easily indent strings or normalize indentation across a multi-line string.
```typescript
import { indent } from '@push.rocks/smartstring';
// Indent a string by 4 spaces
const indentedString = indent.indent('Some text\nAnother line', 4);
console.log(indentedString);
// Indent using a prefix
const prefixedString = indent.indentWithPrefix('Line 1\nLine 2', '> ');
console.log(prefixedString);
// Normalize indentation
const normalizedString = indent.normalize(' Some indented text\n Another line');
console.log(normalizedString);
```
### Creating Random or Encrypted Strings
Create random strings based on patterns or generate cryptographically strong random strings.
```typescript
import { create } from '@push.rocks/smartstring';
// Create a random string
const randomString = create.createRandomString('aA0', 10);
console.log(randomString); // Example output: "a9mB8v2Dq1"
// Create a crypto-random string
const cryptoString = create.createCryptoRandomString(10);
console.log(cryptoString); // Example output: "f28Bb90aCc"
```
### Normalizing Strings
Normalize strings by removing leading/trailing whitespace, fixing indentation, and more.
```typescript
import { normalize } from '@push.rocks/smartstring';
// Normalize a multi-line string
const exampleString = `
This is an example.
The indentation will be fixed.
`;
const normalized = normalize.standard(exampleString);
console.log(normalized);
```
### Working with Docker Environment Variables
Transform an array of Docker environment variables into an object for easy access.
```typescript
import { docker } from '@push.rocks/smartstring';
const envVars = ['NODE_ENV=production', 'PORT=3000'];
const envObject = docker.makeEnvObject(envVars);
console.log(envObject.NODE_ENV); // Output: "production"
console.log(envObject.PORT); // Output: "3000"
```
This guide covers the primary features of `@push.rocks/smartstring`, making string manipulation and information extraction simple and efficient in your TypeScript projects.
## 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.