File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ function formatMessagePart<Message = string>(
86
86
return ctx . interpolate ( ctx . named ( named . k || named . key ) )
87
87
case NodeTypes . List :
88
88
const list = node as ListNode
89
- return ctx . interpolate ( ctx . list ( list . i || list . index ) )
89
+ return ctx . interpolate ( ctx . list ( list . i != null ? list . i : list . index ) )
90
90
case NodeTypes . Linked :
91
91
const linked = node as LinkedNode
92
92
const modifier = linked . m || linked . modifier
Original file line number Diff line number Diff line change @@ -88,6 +88,19 @@ describe('compile', () => {
88
88
} )
89
89
} )
90
90
91
+ test ( 'list issue' , ( ) => {
92
+ const { ast } = baseCompile ( 'hello {0}!' , {
93
+ location : false ,
94
+ jit : true ,
95
+ minify : true
96
+ } )
97
+ const msg = compile ( ast , DEFAULT_CONTEXT )
98
+ const ctx = context ( {
99
+ list : [ 'kazupon' ]
100
+ } )
101
+ expect ( msg ( ctx ) ) . toBe ( 'hello kazupon!' )
102
+ } )
103
+
91
104
test ( 'error' , ( ) => {
92
105
let occured = false
93
106
compile ( 'hello {name!' , {
You can’t perform that action at this time.
0 commit comments