Created
March 19, 2015 14:45
-
-
Save rickydazla/44aeaf541d06ffd2edbe to your computer and use it in GitHub Desktop.
What is this Liquid variable?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% 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 %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also convert the var to json. If it has a quote char, it's a string...