File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export type Template<T extends object> = (data: T) => string;
77/**
88 * Stringify a template into a function.
99 */
10- export function compile ( value : string , displayName = "template" ) {
10+ export function compile ( value : string ) {
1111 let result = QUOTE_CHAR ;
1212 for ( let i = 0 ; i < value . length ; i ++ ) {
1313 const char = value [ i ] ;
@@ -50,16 +50,13 @@ export function compile(value: string, displayName = "template") {
5050 }
5151 result += QUOTE_CHAR ;
5252
53- return `function ${ displayName } (${ INPUT_VAR_NAME } ) { return ${ result } ; }` ;
53+ return `function (${ INPUT_VAR_NAME } ) { return ${ result } ; }` ;
5454}
5555
5656/**
5757 * Fast and simple string templates.
5858 */
59- export function template < T extends object = object > (
60- value : string ,
61- displayName ?: string
62- ) {
63- const body = compile ( value , displayName ) ;
59+ export function template < T extends object = object > ( value : string ) {
60+ const body = compile ( value ) ;
6461 return new Function ( `return (${ body } );` ) ( ) as Template < T > ;
6562}
You can’t perform that action at this time.
0 commit comments