Skip to content

Commit

Permalink
Update customFilters.js
Browse files Browse the repository at this point in the history
used optional chain expression
  • Loading branch information
rishabhr4 committed Oct 3, 2024
1 parent 5510150 commit b9bd819
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/nunjucks-filters/src/customFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function replaceServerVariablesWithValues(url, serverVariables) {
const getVariableValue = (object, variable) => {
const keyValue = object[variable]._json;

if (keyValue) return keyValue.default || (keyValue.enum && keyValue.enum[0]);
if (keyValue) return keyValue.default ?? keyValue.enum?.[0];
};

const urlVariables = getVariablesNamesFromUrl(url);
Expand Down

0 comments on commit b9bd819

Please sign in to comment.