@@ -75,7 +75,7 @@ export function loadConfigFromElement(el: Element): AppConfig {
75
75
srcConfig = mergeConfig ( srcConfig , defaultConfig ) ;
76
76
const result = mergeConfig ( inlineConfig , srcConfig ) ;
77
77
result . pyscript = {
78
- version : version ,
78
+ version,
79
79
time : new Date ( ) . toISOString ( ) ,
80
80
} ;
81
81
return result ;
@@ -140,7 +140,6 @@ function mergeConfig(inlineConfig: AppConfig, externalConfig: AppConfig): AppCon
140
140
}
141
141
142
142
function parseConfig ( configText : string , configType = 'toml' ) {
143
- let config : object ;
144
143
if ( configType === 'toml' ) {
145
144
try {
146
145
// TOML parser is soft and can parse even JSON strings, this additional check prevents it.
@@ -150,7 +149,7 @@ function parseConfig(configText: string, configType = 'toml') {
150
149
`The config supplied: ${ configText } is an invalid TOML and cannot be parsed`
151
150
) ;
152
151
}
153
- config = toml . parse ( configText ) ;
152
+ return toml . parse ( configText ) ;
154
153
} catch ( err ) {
155
154
const errMessage : string = err . toString ( ) ;
156
155
throw new UserError (
@@ -160,7 +159,7 @@ function parseConfig(configText: string, configType = 'toml') {
160
159
}
161
160
} else if ( configType === 'json' ) {
162
161
try {
163
- config = JSON . parse ( configText ) ;
162
+ return JSON . parse ( configText ) ;
164
163
} catch ( err ) {
165
164
const errMessage : string = err . toString ( ) ;
166
165
throw new UserError (
@@ -174,7 +173,6 @@ function parseConfig(configText: string, configType = 'toml') {
174
173
`The type of config supplied '${ configType } ' is not supported, supported values are ["toml", "json"]`
175
174
) ;
176
175
}
177
- return config ;
178
176
}
179
177
180
178
function validateConfig ( configText : string , configType = 'toml' ) {
0 commit comments