Skip to content

Commit 641d3a9

Browse files
committed
fix text parser ignoring last char
1 parent a9a046e commit 641d3a9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/parse/text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ exports.parse = function (text) {
9595
})
9696
lastIndex = index + match[0].length
9797
}
98-
if (lastIndex < text.length - 1) {
98+
if (lastIndex < text.length) {
9999
tokens.push({
100100
value: text.slice(lastIndex)
101101
})

test/unit/specs/parse/text_spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ var testCases = [
4343
{ value: ' and ' },
4444
{ tag: true, value: 'hello', html: false, oneTime: false, partial: true }
4545
]
46+
},
47+
{
48+
text: '[{{abc}}]',
49+
expected: [
50+
{ value: '[' },
51+
{ tag: true, value: 'abc', html: false, oneTime: false },
52+
{ value: ']' }
53+
]
4654
}
4755
]
4856

0 commit comments

Comments
 (0)