Library for processing Cue Sheet, with tolerant parser.
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('')
You can get parsed Cue Sheet via sheet
.
By default, parser is tolerant for syntax.
If there're syntax errors, you can get errors via errors
,
while you still can get parsed result in sheet
.
Error will be thrown instead of being collected in errors
if fatal
option is set to true
.
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { fatal: true })
It will require at least one track in the sheet if checkAtLeastOneTrack
option is set to true
.
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { checkAtLeastOneTrack: true })
Position of FILE
command will be checked if strictFileCommandPosition
option is set to true
.
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictFileCommandPosition: true })
Performer string with more that 80 characters will be treated as an error if strictPerformerLength
option is set to true
.
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictPerformerLength: true })
Song writer string with more that 80 characters will be treated as an error if strictSongWriterLength
option is set to true
.
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictSongWriterLength: true })
Title string with more that 80 characters will be treated as an error if strictTitleLength
option is set to true
.
import { parse } from '@gplane/cue'
const { sheet, errors } = parse('', { strictTitleLength: true })
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet)
You can pass Cue Sheet object (for example, the sheet
value returned from parse
function) to it.
There're some limitations:
- Dumping comments by using
REM
command is not supported. - It won't validate the Cue Sheet. For example, if file name of
FILE
command is an empty string, it will still be dumped without checking.
Only '\n'
or '\r\n'
is allowed. Default value is '\n'
.
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet, { lineBreak: '\r\n' })
Only '\t'
or ' '
is allowed. Default value is ' '
.
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet, { indentKind: '\t' })
// or
const text = dump(sheet, { indentKind: ' ' })
Only positive integer is allowed. Default value is 2
.
import { dump } from '@gplane/cue'
const sheet = {
/* ... */
}
const text = dump(sheet, { indentSize: 4 })
MIT License
Copyright (c) 2021-present Pig Fang