Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new tag - parseAssign #29

Merged
merged 2 commits into from
Apr 14, 2022
Merged

add new tag - parseAssign #29

merged 2 commits into from
Apr 14, 2022

Conversation

sanket0896
Copy link

This MR adds a new tag to our fork of LiquidJS. THE TAG IS called parseAssign.

It converts array or objects passed as a string to their JS object value and assigns these values to the key provided. This key is then appended to the Scope.

{% parseAssign arr = "[1,2,3]" %}
{% parseAssign obj = '{"prop1": prop1Val, "prop2": prop2Val}' %}

Result:
Scope now has

{
    ...,
    arr: [1,2,3],
    obj: {
        prop1: prop1Val,
        prop2: prop2Val
    }
}

Note: The value being assigned should be valid JSON. Invalid JSON will results in exception being thrown.

Passes tests
Screenshot 2022-04-13 at 5 51 26 PM

@sanket0896 sanket0896 self-assigned this Apr 13, 2022
@sanket0896 sanket0896 removed the request for review from codebreach April 13, 2022 12:40
@sanket0896
Copy link
Author

Note: Please squash and merge

@anirudhvarma12 anirudhvarma12 merged commit bf84546 into master Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants