https://github.com/evanpatchouli/js-text-chart
js-text-chart is a tool to transform a string of a text into a string of the chart of the text.
https://github.com/evanpatchouli/js-text-chart
Last synced: about 2 months ago
JSON representation
js-text-chart is a tool to transform a string of a text into a string of the chart of the text.
- Host: GitHub
- URL: https://github.com/evanpatchouli/js-text-chart
- Owner: Evanpatchouli
- License: mit
- Created: 2023-02-05T05:52:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-22T04:13:33.000Z (almost 3 years ago)
- Last Synced: 2024-03-23T07:03:49.610Z (about 2 years ago)
- Language: TypeScript
- Size: 89.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# js-text-chart
js-text-chart is a tool to transform a string of a text into a string of the chart of the text.
## Latest Version: 1.0.9
Completely fix the import-requrie bug, v1.0.9 is strongly recommended. Besides, evchart and exchart are deprecated, and will be removed since v1.1.0.
**v1.0.8 ~ v1.0.3:**
Bug comes while being imported and required.
**v1.0.2**:
Refactored by TypeScript, support commonJs require and esmodule import.
**v1.0.1**:
support capital and small letters and natural numbers.
Besides, only blank and "-" are allowed, others will be treated as blank.
## Code Resource
https://github.com/Evanpatchouli/js-text-chart
## Install
```shell
npm install js-text-chart
```
## Useage
### Code
**CommonJS:**
``` javascript
const JsTextChart = require('js-text-chart');
let str = "js-console-chart";
let mode = [ "close", "far", undefined ];
let chart = JsTextChart.convert(str, mode[0]);
console.log(chart);
```
**ESModule:**
```javascript
import JsTextChart from 'js-text-chart';
let str = "js-console-chart";
let mode = [ "close", "far", undefined ];
let chart = JsTextChart.convert(str, mode[0]);
console.log(chart);
```
The function **convert** returns you with the chart string, and it takes two params: the first one **str** is must, and the **mode** is not necessary, you can assign it to "close", "far" or anyelse which will all be treated as default.
### Output
```
[Running] node "d:\Workstation\js-console-chart\examples\demo.js"
_ _ _ _
(_) | | | | | |
_ ___ ______ ___ ___ _ __ ___ ___ | | ___ ______ ___ | |__ __ _ _ __ | |_
| |/ __||______| / __| / _ \ | '_ \ / __| / _ \ | | / _ \|______| / __|| '_ \ / _` || '__|| __|
| |\__ \ | (__ | (_) || | | |\__ \| (_) || || __/ | (__ | | | || (_| || | | |_
| ||___/ \___| \___/ |_| |_||___/ \___/ |_| \___| \___||_| |_| \__,_||_| \__|
_/ |
|__/
[Done] exited with code=0 in 0.138 seconds
```