@version 0.1.5
@date 2015-04-09
@stability 2 - Unstable
Standard Filters for liquid-lite extending native prototypes.
-
date - reformat a date syntax reference
Require date-format-litevar item = { "timestamp": 1363770186, "datetime": "2013-03-20T09:03:06Z" } {{ timestamp | date:"isoUtcDateTime" }} {{ datetime | date:"hh:mm" }}
-
capitalize - capitalize words in the input sentence
-
downcase - convert an input string to lowercase
-
upcase - convert an input string to uppercase
-
first - get the first element of the passed in array
-
last - get the last element of the passed in array
-
join - join elements of the array with certain character between them.
Native in javascript
-
sort - sort elements of the array
Native in javascript
-
size - return the size of an array or string
-
replace - replace the first or each occurrence.
Native in javascript
{{ 'foofoo' | replace:'foo','bar' }} #=> 'barfoo' {{ 'foofoo' | replace:/foo/g,'bar' }} #=> 'barbar'
-
remove - remove each occurrence e.g. {{ 'foobarfoobar' | remove:'foo' }} #=> 'barbar'
-
split - split a string on a matching pattern e.g. {{ "a
b" | split:}} #=> ['a','b'].Native in javascript
-
pluck - map/collect an array on a given property
-
truncate - truncate a string down to x characters
-
truncatewords - truncate a string down to x words
-
camelCase - camelCase notation
-
humanTime - {{ "13" | humanTime }} #=> "13 seconds", {{ "78" | humanTime }} #=> "1 minute"
-
step - {{ "71" | step:5 }} #=> "70", {{ "12.31" | step:0.2 }} #=> "12.4"
- escape - escape a string
- escape_once - returns an escaped version of html without affecting existing escaped entities
- strip_html - strip html from string
- prepend - prepend a string e.g. {{ 'bar' | prepend:'foo' }} #=> 'foobar'
- append - append a string e.g. {{ 'foo' | append:'bar' }} #=> 'foobar'
- minus - subtraction e.g. {{ 4 | minus:2 }} #=> 2
- plus - addition e.g. {{ '1' | plus:'1' }} #=> '11', {{ 1 | plus:1 }} #=> 2
- times - multiplication e.g {{ 5 | times:4 }} #=> 20
- divided_by - division e.g. {{ 10 | divided_by:2 }} #=> 5
- modulo - remainder, e.g. {{ 3 | modulo:2 }} #=> 1
Copyright (c) 2012 Lauri Rooden <[email protected]>
The MIT License