You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will be fixed in Twing@4.0.2 available later today. Thanks for the report. min and max functions were far from implementing the whole spectrum of TwigPHP equivalent. This is now fixed.
I tired to use the built-in min() function on an array containing negative numbers, but the result was wrong.
Expexted: -20
Got: -10
This is because you do
a.sort()
then returna[0]
and in JS the sort does this:https://github.com/NightlyCommit/twing/blob/master/src/lib/extension/core/functions/min.ts#L10
Better (faster) approach would be:
The max function does not affected because you wrote a proper compare function there.
The text was updated successfully, but these errors were encountered: