fix tests
This commit is contained in:
parent
4841f73de0
commit
73bd703599
|
@ -1,3 +1,3 @@
|
|||
export const TAG_UNESCAPED = ['\\', ' ', ';', '\r', '\n']
|
||||
export const TAG_UNESCAPED_REGEX = [/\\\\/g, / /g, /;/g, /\r/g, /\n/g]
|
||||
export const TAG_UNESCAPED_REGEX = [/\\/g, / /g, /;/g, /\r/g, /\n/g]
|
||||
export const TAG_ESCAPED = ['\\\\', '\\s', '\\:', '\\r', '\\n']
|
||||
|
|
|
@ -33,7 +33,7 @@ export function format ({ tags, source, command, params }: FormatArgs) {
|
|||
|
||||
outs.push(command)
|
||||
|
||||
if (params) {
|
||||
if (params?.length) {
|
||||
const paramCopy = [...params]
|
||||
let last = paramCopy.pop()
|
||||
|
||||
|
|
|
@ -56,8 +56,9 @@ export class Line {
|
|||
}
|
||||
}
|
||||
|
||||
function unescapeTag (value: string) {
|
||||
function unescapeTag (value?: string) {
|
||||
let unescaped = ''
|
||||
if (!value) return unescaped
|
||||
const escaped = value.split('')
|
||||
while (escaped.length) {
|
||||
const current = escaped.shift() as string
|
||||
|
@ -102,7 +103,7 @@ function _tokenise (line: string) {
|
|||
if (!params.length) throw TypeError('Cannot tokenise command-less line')
|
||||
const command = (params.shift() as string).toLocaleUpperCase()
|
||||
|
||||
if (trailing) params.push(trailing)
|
||||
if (typeof trailing === 'string') params.push(trailing)
|
||||
|
||||
return new Line({
|
||||
tags,
|
||||
|
|
Loading…
Reference in New Issue