Skip to content

Commit

Permalink
refactor: make current type immutable in parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowtime2000 committed Dec 5, 2020
1 parent 3a0cd3f commit c0deae3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,7 @@ export default function parse(str: string, config: EtaConfig): Array<AstObject>

trimLeftOfNextStr = closeTag[2]

let currentType: TagType = ''
if (prefix === parseOptions.exec) {
currentType = 'e'
} else if (prefix === parseOptions.raw) {
currentType = 'r'
} else if (prefix === parseOptions.interpolate) {
currentType = 'i'
}
const currentType: TagType = prefix === parseOptions.exec ? 'e' : (prefix === parseOptions.raw ? 'r' : (prefix === parseOptions.interpolate ? 'i' : ''))

currentObj = { t: currentType, val: content }
break
Expand Down

0 comments on commit c0deae3

Please sign in to comment.