Skip to content

Instantly share code, notes, and snippets.

@rickydazla
Created March 19, 2015 14:45
Show Gist options
  • Select an option

  • Save rickydazla/44aeaf541d06ffd2edbe to your computer and use it in GitHub Desktop.

Select an option

Save rickydazla/44aeaf541d06ffd2edbe to your computer and use it in GitHub Desktop.
What is this Liquid variable?
{% assign return = false %}
{% assign variable = your_variable %}
{% assign variable-to-string = variable | strip %}
{% assign variable-to-integer = variable | plus: 0 %}
{% if variable-to-string == variable %}
{% assign return = "string" %}
{% elsif variable-to-integer == variable %}
{% assign return = "integer" %}
{% else %}
{% assign return = "undefined" %}
{% endif %}
@freakdesign
Copy link

You could also convert the var to json. If it has a quote char, it's a string...

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