vtex-emails icon indicating copy to clipboard operation
vtex-emails copied to clipboard

Fix eval helper to match VTEX's implementation

Open jpesce opened this issue 2 years ago • 1 comments

There are extra spaces (probably due to code autoformatting) in the regex inside the eval helper that make it behave differently from VTEX's actual eval helper. This PR fixes this.

Tests

Here's the result of the expression {{eval "'${string}'.split(' ')[0]" string=_accountInfo.CompanyName}} inside an 'Order Confirmation' template on a VTEX production environment: Screen Shot 2022-05-03 at 20 08 08

Here's the result in the current version of vtex-emails (before this fix): Screen Shot 2022-05-03 at 20 06 12

Here's the result after the fix: Screen Shot 2022-05-03 at 20 07 30

jpesce avatar May 03 '22 23:05 jpesce