This repository was archived by the owner on Mar 16, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1
1
module . exports = {
2
- render : render ,
2
+ compile : compile ,
3
3
setOptions : setOptions
4
4
}
5
5
@@ -11,7 +11,7 @@ function setOptions(_opt){
11
11
opt . templatePattern = _opt . templatePattern || / \{ ( .* ?) \} / g
12
12
}
13
13
14
- function render ( t , data ) {
14
+ function compile ( t , data ) {
15
15
return t . replace ( opt . templatePattern , function ( match , prop ) {
16
16
return data [ prop ] || match
17
17
} )
Original file line number Diff line number Diff line change @@ -7,13 +7,13 @@ describe('Templater', function() {
7
7
8
8
it ( 'renders the template with the provided data' , function ( ) {
9
9
expect (
10
- templater . render ( '{foo}' , { foo :'bar' } )
10
+ templater . compile ( '{foo}' , { foo :'bar' } )
11
11
) . toEqual (
12
12
'bar'
13
13
)
14
14
15
15
expect (
16
- templater . render ( '<a href="{url}">url</a>' , { url :'http://google.com' } )
16
+ templater . compile ( '<a href="{url}">url</a>' , { url :'http://google.com' } )
17
17
) . toEqual (
18
18
'<a href="http://google.com">url</a>'
19
19
)
@@ -22,7 +22,7 @@ describe('Templater', function() {
22
22
it ( 'replaces not found properties with the original pattern' , function ( ) {
23
23
var template = '{foo}'
24
24
expect (
25
- templater . render ( template , { x :'bar' } )
25
+ templater . compile ( template , { x :'bar' } )
26
26
) . toEqual (
27
27
template
28
28
)
@@ -33,7 +33,7 @@ describe('Templater', function() {
33
33
templatePattern :/ \{ \{ ( .* ?) \} \} / g
34
34
} )
35
35
expect (
36
- templater . render ( '{{foo}}' , { foo :'bar' } )
36
+ templater . compile ( '{{foo}}' , { foo :'bar' } )
37
37
) . toEqual (
38
38
'bar'
39
39
)
Original file line number Diff line number Diff line change 86
86
return appendToResultsContainer ( options . noResultsText )
87
87
}
88
88
for ( var i = 0 ; i < results . length ; i ++ ) {
89
- appendToResultsContainer ( templater . render ( options . searchResultTemplate , results [ i ] ) )
89
+ appendToResultsContainer ( templater . compile ( options . searchResultTemplate , results [ i ] ) )
90
90
}
91
91
}
92
92
You can’t perform that action at this time.
0 commit comments