Skip to content

Commit

Permalink
refactor: better readability of buildLineCore filter (#1301)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukasz Gornicki <[email protected]>
  • Loading branch information
thebedigupta and derberg authored Oct 15, 2024
1 parent 298479a commit 25c4e53
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/nunjucks-filters/src/customFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ function docline(field, fieldName, scopePropName) {
const getPName = (pName) => pName ? `${pName}.` : '';

const buildLineCore = (type, def, pName, fName) => {
return `* @param {${type}} ${pName}${fName}${def !== undefined ? `=${def}` : ''}`;
const paramName = `${pName}${fName}`;
const defaultValue = def !== undefined ? `=${def}` : '';
return `* @param {${type}} ${paramName}${defaultValue}`;
};

const buildLine = (f, fName, pName) => {
const type = getType(f);
const def = getDefault(f, type);
Expand Down

0 comments on commit 25c4e53

Please sign in to comment.