LiquidJS 支持 Liquid 语法中具体业务无关的过滤器,基本上 shopify/liquid 核心 支持的 LiquidJS 都支持。这部分包含了所有 LiquidJS 支持的过滤器的文档和使用示例。
LiquidJS 共支持 40+ 个过滤器,可以分为如下几类:
类别 | 过滤器 |
---|---|
数学 | plus, minus, modulo, times, floor, ceil, round, divided_by, abs, at_least, at_most |
字符串 | append, prepend, capitalize, upcase, downcase, strip, lstrip, rstrip, strip_newlines, split, replace, replace_first, replace_last, remove, remove_first, remove_last, truncate, truncatewords, normalize_whitespace, number_of_words, array_to_sentence_string |
HTML/URI | escape, escape_once, url_encode, url_decode, strip_html, newline_to_br, xml_escape, cgi_escape, uri_escape, slugify |
数组 | slice, map, sort, sort_natural, uniq, where, where_exp, group_by, group_by_exp, find, find_exp, first, last, join, reverse, concat, compact, size, push, pop, shift, unshift |
日期 | date, date_to_xmlschema, date_to_rfc822, date_to_string, date_to_long_string |
其他 | default, json, jsonify, inspect, raw, to_integer |