mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
28 lines
594 B
TypeScript
28 lines
594 B
TypeScript
import Token from './token'
|
|
import { last } from '../util/underscore'
|
|
|
|
export default class DelimitedToken extends Token {
|
|
constructor (
|
|
raw: string,
|
|
value: string,
|
|
input: string,
|
|
line: number,
|
|
pos: number,
|
|
trimLeft: boolean,
|
|
trimRight: boolean,
|
|
file?: string
|
|
) {
|
|
super(raw, input, line, pos, file)
|
|
const tl = value[0] === '-'
|
|
const tr = last(value) === '-'
|
|
this.value = value
|
|
.slice(
|
|
tl ? 1 : 0,
|
|
tr ? -1 : value.length
|
|
)
|
|
.trim()
|
|
this.trimLeft = tl || trimLeft
|
|
this.trimRight = tr || trimRight
|
|
}
|
|
}
|