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

String values should evaluate "first" and "last" #781

Closed
sebastienros opened this issue Dec 23, 2024 · 4 comments
Closed

String values should evaluate "first" and "last" #781

sebastienros opened this issue Dec 23, 2024 · 4 comments

Comments

@sebastienros
Copy link

Same as size there are other pseudo properties strings should evaluate.
And length is one that LiquidJs supports but is not valid.

Here is from the shopify's site:

image

@jg-rp
Copy link
Contributor

jg-rp commented Dec 23, 2024

Interestingly, using Shopify/Liquid directly instead of via a Shopify store, we get the following:

require 'liquid'

source = <<~LIQUID
  {% assign b = "one" %}
  size:   {{ b.size }}
  length: {{ b.length }}
  first:  {{ b.first }}
  last:   {{ b.last }}
LIQUID

template = Liquid::Template.parse(source)
puts template.render

output


size:   3
length: 
first:  
last:   

@harttle
Copy link
Owner

harttle commented Dec 23, 2024

Thank you two for the investigation. I think we can support this feature in liquidjs, people can’t blame us for not returning nil right?

github-actions bot pushed a commit that referenced this issue Dec 28, 2024
# [10.20.0](v10.19.1...v10.20.0) (2024-12-28)

### Features

* `size`, `first`, `last` support arraylike objects, [#781](#781) ([35a8442](35a8442))
* static variable analysis ([#770](#770)) ([3492ff6](3492ff6))
@jg-rp
Copy link
Contributor

jg-rp commented Jan 17, 2025

See also Shopify/liquid#1881.

@harttle
Copy link
Owner

harttle commented Jan 19, 2025

Closing as implemented in 10.20.0

@harttle harttle closed this as completed Jan 19, 2025
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

3 participants