vtex-emails
vtex-emails copied to clipboard
Fix eval helper to match VTEX's implementation
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:
Here's the result in the current version of vtex-emails
(before this fix):
Here's the result after the fix: