Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Preserve numeric keys on #each helper#18

Merged
sam-osborne merged 2 commits into
salesforce:masterfrom
inkarnation:master
Jan 10, 2023
Merged

Preserve numeric keys on #each helper#18
sam-osborne merged 2 commits into
salesforce:masterfrom
inkarnation:master

Conversation

@inkarnation

Copy link
Copy Markdown
Contributor

Preserving numeric keys on #each helper, to maintain @key data variable functioning on int arrays

Assuming an array should be printed out like (enableDataVariables set to true):

{{#each arr}}
    {{ @key }}:   {{ this }}
{{/each}}

which was defined as

$arr = [
    '19' => 5
];

(key can be any integer)
The resulting @key variable was always printed as 0. array_slicein the helper function caused numeric keys to be set to 0 while maintaing string keys correctly. The pull request is enabling explicit key preserving, to fix such issue.

Preserving keyys on #each helper, to maintain @key data variable functioning on int arrays
@salesforce-cla

salesforce-cla Bot commented Dec 4, 2022

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @inkarnation to sign the Salesforce.com Contributor License Agreement.

@sam-osborne sam-osborne merged commit 2a60abc into salesforce:master Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants