Skip to content

Commit

Permalink
Make parenthesis for parameters optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineveldhoven committed Sep 26, 2023
1 parent a23266a commit f7c4666
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/twig.expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ module.exports = function (Twig) {
* ((params) => body)
*/
type: Twig.expression.type.filterCallbackFunction,
regex: /^\(\(([\w\s]+(?:,\s?[\w\s]+)*)\)\s*=>\s*[{}]*(.*)[}]*\)/,
regex: /^\(\(*([\w\s]+(?:,\s?[\w\s]+)*)\)*\s*=>\s*[{}]*(.*)[}]*\)/,
next: Twig.expression.set.expressions.concat([Twig.expression.type.subexpression.end]),
compile(token, stack, output) {
const filter = output.pop();
Expand All @@ -496,7 +496,7 @@ module.exports = function (Twig) {
}

filter.params = token;
token.params = token.match[1];
token.params = token.match[1].trim();
token.body = '{{ ' + token.match[2] + ' }}';
output.push(filter);
},
Expand Down

0 comments on commit f7c4666

Please sign in to comment.