Using the three-way comparison operator (<=>) when sorting results in an error, but swapping it out for the underlying functionality works fine. It would be nice to be able to utilize the built-in operator.
[error] templates/_includes/job-block.twig: Error: ERROR: Unexpected token "operator" of value ">"
[error] 17 |
[error] 18 | {% if entry.jobLocation %}
[error] > 19 | {% for item in entry.jobLocation|sort((a, b) => a.title <=> b.title) %}
[error] | ^
[error] 20 | {% set parents = item.parents[1:]|map(p => p.code ?? p.title)|reverse %}
[error] 21 | {% set locationText = [item.title]|merge(parents)|join(', ') %}
[error] 22 | {{ _self.locationDisplay(item.flag, locationText) }}
[error] at TokenStream.error (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/TokenStream.js:129:24)
[error] at Parser.error (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:452:21)
[error] at Parser.matchPrimaryExpression (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:630:26)
[error] at Parser.getPrimary (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:582:21)
[error] at Parser.matchExpression (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:523:25)
[error] at Parser.matchExpression (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:534:36)
[error] at Parser.matchArrowFunction (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:1001:32)
[error] at Parser.matchArguments (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:933:44)
[error] at Parser.matchFilterExpression (file:///node_modules/@zackad/prettier-plugin-twig/src/melody/melody-
```parser/Parser.js:898:29)
[error] at Parser.matchPostfixExpression (file:///Users/james/code/work/hitmarker/hitmarker-v6/node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:810:29)
Using the three-way comparison operator (<=>) when sorting results in an error, but swapping it out for the underlying functionality works fine. It would be nice to be able to utilize the built-in operator.