https://github.com/gavinning/align-string
align-string
https://github.com/gavinning/align-string
align-string align-text alignment
Last synced: 10 months ago
JSON representation
align-string
- Host: GitHub
- URL: https://github.com/gavinning/align-string
- Owner: gavinning
- License: mit
- Created: 2018-11-26T09:06:51.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-09-28T09:01:02.000Z (over 4 years ago)
- Last Synced: 2025-03-05T01:18:53.342Z (10 months ago)
- Topics: align-string, align-text, alignment
- Language: TypeScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Align-string
---
字符串对齐
### Install
```sh
npm i align-string --save
```
### Usage
```js
import { align, alignVector } from 'align-string'
// or
const { align, alignVector } = require('align-string')
```
#### align
```js
align(arr: string[])
['1.png', 'WechatIMG5289.png', 'WechatIMG5542.jpeg']
// =>
[ '1.png ', 'WechatIMG5289.png ', 'WechatIMG5542.jpeg' ]
```
#### alignVector
```js
alignVector(vector: string[][])
[
[ 1, '192.168.1.1', 'test', '测试机1' ],
[ 21, '192.168.10.2', 'webapp', '测试机264565456456' ],
[ 316, '192.168.1.255', 'preview-server-1', '测试机311' ]
]
// =>
[
[ '1 ', '192.168.1.1 ', 'test ', '测试机1 ' ],
[ '21 ', '192.168.10.2 ', 'webapp ', '测试机264565456456' ],
[ '316', '192.168.1.255', 'preview-server-1', '测试机311 ' ]
]
```