Skip to content

Commit

Permalink
refactor: use optional chaining in template validator (asyncapi#1300)
Browse files Browse the repository at this point in the history
  • Loading branch information
thebedigupta authored Oct 14, 2024
1 parent 6f60d50 commit 0e3478b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/generator/lib/templateConfigValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function getParamSuggestion(wrongParam, configParams) {
* @param {Object} templateParams All parameters provided to generator
*/
function isProvidedParameterSupported(configParams, templateParams) {
const wrongParams = Object.keys(templateParams || {}).filter(key => !configParams || !configParams[key]);
const wrongParams = Object.keys(templateParams || {}).filter(key => !configParams?.[key]);

if (!wrongParams.length) return;
if (!configParams) throw new Error('This template doesn\'t have any params.');
Expand Down

0 comments on commit 0e3478b

Please sign in to comment.