xieyezi-lyric

a package for parsing lyric data

Usage no npm install needed!

<script type="module">
  import xieyeziLyric from 'https://cdn.skypack.dev/xieyezi-lyric';
</script>

README

说在前面

传入字符串类型歌词,按照正则表达式解析,解析的数据结构为:

{
txt:歌词,
time:ms
}

安装

npm install xieyezi-lyric

用法

import xieyeziLyric form 'xieyezi-lyric';
 var Lyric = new Lyric(lyric,handle);
 console.log(Lyric);
//支持传入一个处理函数“handle”
//js里面的handle函数
_callHandler(i) {
if (i < 0) {
    return;
}
this.handler({
    txt: this.lines[i].txt,
    lineNum: i
})
}