提示
用于处理 Cue 工作表的图书馆, 带有宽容的解析器 .
使用量
分析
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('')
您可以通过 sheet。 。 。 .
默认情况下,parser对语法是宽容的.
如果出现语法错误,可以通过 errors, (中文(简体) ),
您还可以得到解析结果 sheet。 。 。 .
fatal 选项
错误将被丢弃而不是被收集到 errors 若为 fatal 选项设定为 true。 。 。 .
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { fatal: true })
checkAtLeastOneTrack 选项
如果 checkAtLeastOneTrack 选项设定为 true。 。 。 .
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { checkAtLeastOneTrack: true })
strictFileCommandPosition 选项
立场 FILE 如果 strictFileCommandPosition 选项设定为 true。 。 。 .
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictFileCommandPosition: true })
strictPerformerLength 选项
超过80个字符的表演者字符串,如果 strictPerformerLength 选项设定为 true。 。 。 .
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictPerformerLength: true })
strictSongWriterLength 选项
超过80个字符的歌曲作者字符串,如果 strictSongWriterLength 选项设定为 true。 。 。 .
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictSongWriterLength: true })
strictTitleLength 选项
标题字符串中, 超过 80 个字符将被视为错误, 如果 strictTitleLength 选项设定为 true。 。 。 .
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictTitleLength: true })
倾销
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet)
您可以通过 Cue 工作表对象(例如 sheet 从 parse 页:1.
有一些限制:
- 通过使用
REM命令不支持. - 它不会验证 Cue Sheet。 例如,如果文件名称为
FILE命令是一个空字符串,它仍然会被丢弃而不检查.
lineBreak 选项
仅 '\n' 或者说 '\r\n' 允许。 默认值是 '\n'。 。 。 .
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet, { lineBreak: '\r\n' })
indentKind 选项
仅 '\t' 或者说 ' ' 允许。 默认值是 ' '。 。 。 .
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet, { indentKind: '\t' })
// or
const text = dump(sheet, { indentKind: ' ' })
indentSize 选项
只允许正整数 。 默认值是 2。 。 。 .
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet, { indentSize: 4 })
参考资料
许可证
MIT 许可证
版权(c)2021年至今