https://github.com/xieyezi/xieyzilyricformat
一个能够将字符串类型的歌词数据解析为对象的NPM包
https://github.com/xieyezi/xieyzilyricformat
formatter lyric-parser rollup web
Last synced: 8 months ago
JSON representation
一个能够将字符串类型的歌词数据解析为对象的NPM包
- Host: GitHub
- URL: https://github.com/xieyezi/xieyzilyricformat
- Owner: xieyezi
- Created: 2019-03-29T07:20:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-29T08:01:41.000Z (over 6 years ago)
- Last Synced: 2025-03-07T20:52:00.430Z (9 months ago)
- Topics: formatter, lyric-parser, rollup, web
- Language: JavaScript
- Size: 18.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### 说在前面
 
传入字符串类型歌词,按照正则表达式解析,解析的数据结构为:
```js
{
txt:歌词,
time:ms
}
```
#### 安装
```js
npm install xieyezi-lyric
```
#### 用法
```js
import xieyeziLyric form 'xieyezi-lyric';
```
```js
var Lyric = new Lyric(lyric,handle);
console.log(Lyric);
//支持传入一个处理函数“handle”
```
```js
//js里面的handle函数
_callHandler(i) {
if (i < 0) {
return;
}
this.handler({
txt: this.lines[i].txt,
lineNum: i
})
}
```