riot-format
a helper library for riotjs to format displays, without external dependencies, inspired by $filter of angular.
The original idea is to make it work with riot, but it can also work without riot.
why riot-format
- no external dependencies
- built-in format: date(), number(), bytes(), json()
- chained format method calls
- easy to extend
- support modern browsers (IE9+)
- compatible with riot
- less than 5kb
Get Started
install it from npm
npm install -D riot-format
Use it with riot
mixin
//mixin globally
use it in riot tag
Today is { format(now, 'date', 'yyyy-mm-dd') } this.now = new Date()
Use it directly without riot
let formatter = console//Note: formatter.current is lazily evaluated until you access it
For more information, see Get Started
More
Plans
- add currency support
License
MIT