mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
perf: remove instanceof DelimitedToken
This commit is contained in:
+13
-12
@@ -1,14 +1,15 @@
|
||||
export enum TokenKind {
|
||||
Number,
|
||||
Literal,
|
||||
Tag,
|
||||
Output,
|
||||
HTML,
|
||||
Filter,
|
||||
Hash,
|
||||
PropertyAccess,
|
||||
Word,
|
||||
Range,
|
||||
Quoted,
|
||||
Operator
|
||||
Number = 1,
|
||||
Literal = 2,
|
||||
Tag = 4,
|
||||
Output = 8,
|
||||
HTML = 16,
|
||||
Filter = 32,
|
||||
Hash = 64,
|
||||
PropertyAccess = 128,
|
||||
Word = 256,
|
||||
Range = 512,
|
||||
Quoted = 1024,
|
||||
Operator = 2048,
|
||||
Delimited = Tag | Output
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Token } from '../tokens/token'
|
||||
import { DelimitedToken } from '../tokens/delimited-token'
|
||||
import { isTagToken, isHTMLToken } from '../util/type-guards'
|
||||
import { isTagToken, isHTMLToken, isDelimitedToken } from '../util/type-guards'
|
||||
import { NormalizedFullOptions } from '../liquid-options'
|
||||
import { TYPES, INLINE_BLANK, BLANK } from '../util/character'
|
||||
|
||||
@@ -10,7 +9,7 @@ export function whiteSpaceCtrl (tokens: Token[], options: NormalizedFullOptions)
|
||||
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
const token = tokens[i]
|
||||
if (!(token instanceof DelimitedToken)) continue
|
||||
if (!isDelimitedToken(token)) continue
|
||||
if (!inRaw && token.trimLeft) {
|
||||
trimLeft(tokens[i - 1], options.greedy)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user