chore(TypeScript): refactor objects into classes

fix: `Nil`(null, undefined) now renders as empty string
change: `parser.parseValue()` renamed to `parser.parseOutput`
change: registered tags/filters become static and shared across different liquid instances
This commit is contained in:
harttle
2019-02-17 04:55:30 +08:00
parent b51b0dabca
commit 677e8511e6
134 changed files with 3327 additions and 3858 deletions
+12
View File
@@ -0,0 +1,12 @@
import Token from './token'
export default class DelimitedToken extends Token {
trim_left: boolean
trim_right: boolean
constructor(raw, pos, input, file, line) {
super(raw, pos, input, file, line)
this.trim_left = raw[2] === '-'
this.trim_right = raw[raw.length - 3] === '-'
this.value = raw.slice(this.trim_left ? 3 : 2, this.trim_right ? -3 : -2).trim()
}
}