(input_js: string | Function)
| 1250 | } |
| 1251 | |
| 1252 | function createControls(input_js: string | Function) { |
| 1253 | // Create a new instance of Controls |
| 1254 | const controls = new Controls() |
| 1255 | |
| 1256 | let getInputFunc: Function; |
| 1257 | |
| 1258 | if (typeof input_js === 'function') { |
| 1259 | // If input_js is already a function, use it directly |
| 1260 | getInputFunc = input_js; |
| 1261 | } else { |
| 1262 | // If input_js is a string, create a function from it (legacy behavior) |
| 1263 | const code = input_js + "\n return getInput(controls);" |
| 1264 | getInputFunc = new Function("controls", code); |
| 1265 | } |
| 1266 | |
| 1267 | // Execute the function, passing the 'controls' instance |
| 1268 | getInputFunc(controls) |
| 1269 | |
| 1270 | // Return the modified 'controls' instance with all added controls |
| 1271 | return controls |
| 1272 | } |
| 1273 | |
| 1274 | |
| 1275 | export { Controls, createControls, FileTypes } |
no outgoing calls
no test coverage detected