update tsconfig
This commit is contained in:
parent
5dd1a868c6
commit
dbd0a23e33
@ -9,12 +9,20 @@
|
|||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartcsv",
|
"gitrepo": "smartcsv",
|
||||||
"description": "handle csv data | gitzone standard compliant",
|
"description": "A module for handling CSV data compliant with Gitzone standard.",
|
||||||
"npmPackagename": "@push.rocks/smartcsv",
|
"npmPackagename": "@push.rocks/smartcsv",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"keywords": [
|
||||||
|
"CSV",
|
||||||
|
"data parsing",
|
||||||
|
"data conversion",
|
||||||
|
"TypeScript",
|
||||||
|
"CSV manipulation",
|
||||||
|
"CSV to JSON"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
10
package.json
10
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@push.rocks/smartcsv",
|
"name": "@push.rocks/smartcsv",
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "handle csv data | gitzone standard compliant",
|
"description": "A module for handling CSV data compliant with Gitzone standard.",
|
||||||
"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",
|
||||||
@ -39,5 +39,13 @@
|
|||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"CSV",
|
||||||
|
"data parsing",
|
||||||
|
"data conversion",
|
||||||
|
"TypeScript",
|
||||||
|
"CSV manipulation",
|
||||||
|
"CSV to JSON"
|
||||||
]
|
]
|
||||||
}
|
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
133
readme.md
133
readme.md
@ -1,41 +1,118 @@
|
|||||||
# @pushrocks/smartcsv
|
# @push.rocks/smartcsv
|
||||||
handle csv data | gitzone standard compliant
|
handle csv data | gitzone standard compliant
|
||||||
|
|
||||||
## Availabililty and Links
|
## Install
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartcsv)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartcsv)
|
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartcsv)
|
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartcsv/)
|
|
||||||
|
|
||||||
## Status for master
|
To install `@push.rocks/smartcsv`, use the following command with npm:
|
||||||
|
|
||||||
Status Category | Status Badge
|
```sh
|
||||||
-- | --
|
npm install @push.rocks/smartcsv --save
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartcsv/badges/master/pipeline.svg)](https://lossless.cloud)
|
```
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartcsv/badges/master/coverage.svg)](https://lossless.cloud)
|
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartcsv)](https://lossless.cloud)
|
Or, if you prefer using Yarn:
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartcsv)](https://lossless.cloud)
|
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
```sh
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
yarn add @push.rocks/smartcsv
|
||||||
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/smartcsv)](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartcsv)](https://lossless.cloud)
|
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartcsv)](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
|
||||||
|
|
||||||
## Contribution
|
`@push.rocks/smartcsv` is a powerful library designed for handling CSV data efficiently and in a developer-friendly manner. This document will guide you through various use cases and demonstrate the flexibility and capabilities of `@push.rocks/smartcsv`.
|
||||||
|
|
||||||
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). :)
|
### Importing the Module
|
||||||
|
|
||||||
## Contribution
|
First, import `Csv` from the `@push.rocks/smartcsv` package into your TypeScript file:
|
||||||
|
|
||||||
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). :)
|
```typescript
|
||||||
|
import { Csv } from '@push.rocks/smartcsv';
|
||||||
|
```
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
### Creating a CSV Instance from a String
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
You can create a `Csv` instance directly from a string. This is particularly useful when you have CSV data as a string from a file or an API response:
|
||||||
| 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)
|
```typescript
|
||||||
|
const csvString = `Name, Age, Occupation\nJohn Doe, 28, Software Developer\nJane Smith, 32, Data Scientist`;
|
||||||
|
|
||||||
|
const csvOptions = {
|
||||||
|
headers: true, // indicates the first row contains headers
|
||||||
|
unquote: true, // unquote values if necessary
|
||||||
|
trimSpace: true, // trim spaces around values
|
||||||
|
removeBomMarkers: true // remove BOM markers if present
|
||||||
|
};
|
||||||
|
|
||||||
|
const csvInstance = await Csv.createCsvFromString(csvString, csvOptions);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Exporting CSV Data as JSON
|
||||||
|
|
||||||
|
Once you have a `Csv` instance, you can convert the CSV data into JSON objects for easier manipulation and access:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const jsonData = await csvInstance.exportAsObject();
|
||||||
|
console.log(jsonData);
|
||||||
|
```
|
||||||
|
|
||||||
|
This will output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{ "Name": "John Doe", "Age": "28", "Occupation": "Software Developer" },
|
||||||
|
{ "Name": "Jane Smith", "Age": "32", "Occupation": "Data Scientist" }
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating a CSV String from an Array of Objects
|
||||||
|
|
||||||
|
If you have an array of objects and wish to convert it into a CSV string, `@push.rocks/smartcsv` offers a straightforward approach:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const arrayOfObjects = [
|
||||||
|
{ Name: "John Doe", Age: 28, Occupation: "Software Developer" },
|
||||||
|
{ Name: "Jane Smith", Age: 32, Occupation: "Data Scientist" }
|
||||||
|
];
|
||||||
|
|
||||||
|
const csvString = await Csv.createCsvStringFromArray(arrayOfObjects);
|
||||||
|
console.log(csvString);
|
||||||
|
```
|
||||||
|
|
||||||
|
This will generate a CSV string that represents the array of objects provided.
|
||||||
|
|
||||||
|
### Advanced Usage
|
||||||
|
|
||||||
|
#### Custom Separator Detection
|
||||||
|
|
||||||
|
By default, `@push.rocks/smartcsv` intelligently detects the separator used in the input CSV data (either a comma `,` or a semicolon `;`). You can rely on this automatic detection or specify preferred options for finer control over how your CSV data is handled.
|
||||||
|
|
||||||
|
#### Handling Quotes and BOM Markers
|
||||||
|
|
||||||
|
The library is capable of processing CSV files that include quoted fields, optionally removing quotes where necessary. Similarly, it can handle Byte Order Mark (BOM) markers at the start of UTF-8 encoded files, ensuring that the text is interpreted correctly.
|
||||||
|
|
||||||
|
#### Trimming Spaces
|
||||||
|
|
||||||
|
For data cleanliness, `@push.rocks/smartcsv` can trim leading and trailing spaces from values in the CSV, ensuring that the resulting data is neat and uniform.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
`@push.rocks/smartcsv` offers a comprehensive set of features for working with CSV data in TypeScript, providing flexibility, ease of use, and powerful data manipulation capabilities. Whether you're importing CSV data from a file, converting JSON to CSV, or manipulating CSV strings directly in your application, `@push.rocks/smartcsv` has you covered.
|
||||||
|
|
||||||
|
For detailed API documentation, please refer to the [official documentation](https://pushrocks.gitlab.io/smartcsv/).
|
||||||
|
|
||||||
|
## 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