File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ export class CommitFormatter {
134
134
options = dateFormatOrOptions ;
135
135
}
136
136
137
- return Strings . interpolateLazy ( template , new CommitFormatter ( commit , options ) ) ;
137
+ return Strings . interpolate ( template , new CommitFormatter ( commit , options ) ) ;
138
138
}
139
139
140
140
static toHoverAnnotation ( commit : GitCommit , dateFormat : string = 'MMMM Do, YYYY h:MMa' ) : string | string [ ] {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- import { Objects } from './object' ;
3
2
const _escapeRegExp = require ( 'lodash.escaperegexp' ) ;
4
3
5
4
export namespace Strings {
@@ -37,13 +36,11 @@ export namespace Strings {
37
36
return tokens ;
38
37
}
39
38
40
- export function interpolate ( template : string , tokens : { [ key : string ] : any } ) : string {
41
- return new Function ( ...Object . keys ( tokens ) , `return \`${ template } \`;` ) ( ...Objects . values ( tokens ) ) ;
42
- }
39
+ export function interpolate ( template : string , context : object ) : string {
40
+ if ( ! template ) return template ;
43
41
44
- export function interpolateLazy ( template : string , context : object ) : string {
45
- template = template . replace ( TokenSanitizeRegex , '$${c.$1}' ) ;
46
- return new Function ( 'c' , `return \`${ template } \`;` ) ( context ) ;
42
+ template = template . replace ( TokenSanitizeRegex , '$${this.$1}' ) ;
43
+ return new Function ( `return \`${ template } \`;` ) . call ( context ) ;
47
44
}
48
45
49
46
export function padLeft ( s : string , padTo : number , padding : string = '\u00a0' ) {
You can’t perform that action at this time.
0 commit comments