expressions
Grab bag of template-binding expressions.
For use with new template-binding standards.
API
json
Convert to pretty-printed json output.
Usage:
{{data | json}}
log
Log to console before returning input.
Very useful for debugging.
Usage:
{{data | log}}{{data | log('my data %s')}}{{data | log('my data %s, %d', otherdata)}}
slice
Slice an array of data.
Usage:
{{items | slice}}{{items | slice(2)}}{{items | slice(2, 5)}}
keys
Get array of keys from an Object.
Usage:
{{key}}
values
Get array of values from an Object.
Usage:
{{value}}
keyValue
Get array of keys and values from an Object.
Usage:
{{item.key}} : {{item.value}}
date
Format a date using moment.js.
Usage:
{{item.date | date}}{{item.date | date('LLL')}}
fromNow
Get relative time from now.
Usage:
{{item.date | fromNow}} <!-- 2 weeks ago. -->
calendar
Get relative 'calendar' time.
Usage:
{{item.date | fromNow}} <!-- 2 weeks ago. -->
TODO
Examples and tests.
License
MIT