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

Fix slice #72

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Fix slice #72

wants to merge 3 commits into from

Conversation

ofavre
Copy link
Contributor

@ofavre ofavre commented Sep 16, 2022

slice was broken with an offset or length above 1000.
Shopify documents that slice supports arrays in addition to strings; I added support for working on slices.

Checklist

  • I have read the contribution guidelines.
  • make test passes.
  • make lint passes. (at least on modified files)
  • New and changed code is covered by tests.
  • Performance improvements include benchmarks.
  • Changes match the documented (not just the implemented) behavior of Shopify.

These tests currently pass, so I'm committing them alone

I intend on changing the implementation and need to ensure they stay
green.
The previous implementation compiled a regex on the fly, using a
repetition count that could go above the supported range, causing it to
panic.

This implementation should work on any string size, offset and length.

I added edge case tests when using out-of-bounds values. I do not know
what Shopify implementation would return, and the documentation does not
specify any behavior, so I came up with a sensible behavior.
Shopify's Liquid documentation says it works on arrays. This was not
covered by the previous implementations.
@danog
Copy link
Collaborator

danog commented Aug 15, 2023

Hi! Mind rebasing this? :)

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