(optional, request, runtimeTemplate)
| 744 | * @returns {SourceData} the generated source |
| 745 | */ |
| 746 | const getSourceForDefaultCase = (optional, request, runtimeTemplate) => { |
| 747 | if (!Array.isArray(request)) { |
| 748 | // make it an array as the look up works the same basically |
| 749 | request = [request]; |
| 750 | } |
| 751 | |
| 752 | const variableName = request[0]; |
| 753 | const objectLookup = propertyAccess(request, 1); |
| 754 | return { |
| 755 | init: optional |
| 756 | ? checkExternalVariable(variableName, request.join("."), runtimeTemplate) |
| 757 | : undefined, |
| 758 | expression: `${variableName}${objectLookup}` |
| 759 | }; |
| 760 | }; |
| 761 | |
| 762 | /** @typedef {Record<string, string | string[]>} RequestRecord */ |
| 763 | /** @typedef {string | string[] | RequestRecord} ExternalModuleRequest */ |
no test coverage detected