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

Access array items from the right with negative indexes #486

Closed
jg-rp opened this issue Mar 3, 2022 · 1 comment
Closed

Access array items from the right with negative indexes #486

jg-rp opened this issue Mar 3, 2022 · 1 comment

Comments

@jg-rp
Copy link
Contributor

jg-rp commented Mar 3, 2022

When accessing items in an array using a negative integer, Ruby Liquid will return an item counting from the right, or nil if the index is out of range. LiquidJS currently returns undefined when a negative index is used to access an array's items.

Template:

{% assign a = "x,y,z" | split: ',' -%}
{{ a[-1] }} {{ a[-3] }}

Expected output:

z x

Actual output:


@harttle harttle closed this as completed in 049685b Mar 5, 2022
github-actions bot pushed a commit that referenced this issue Mar 5, 2022
# [9.36.0](v9.35.2...v9.36.0) (2022-03-05)

### Features

* Access array item by negative index, closes [#486](#486) ([049685b](049685b))
* allow strip filter with specified char, closes [#390](#390) ([c503cb2](c503cb2))
* appropriate error for malformed filters, fixes [#271](#271) ([01014ed](01014ed))
@github-actions
Copy link

github-actions bot commented Mar 5, 2022

🎉 This issue has been resolved in version 9.36.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants