uniq
array | uniq
Removes any duplicate items in an array.
{% assign potion_array = 'invisibility, health, love, health, invisibility' | split: ', ' %}
{{ potion_array | uniq | join: ', ' }}
{% assign potion_array = 'invisibility, health, love, health, invisibility' | split: ', ' %}
{{ potion_array | uniq | join: ', ' }}
Output
invisibility, health, love
Was this page helpful?