1.1.1 • Published 7 years ago

riot-format v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

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.

NPM version NPM downloads MIT License

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

import format from 'riot-format'
import * as riot from 'riot'
format(riot) //mixin globally

use it in riot tag

<app>
  <p>Today is { format(now, 'date', 'yyyy-mm-dd') }</p>

  this.now = new Date()
<app>

Use it directly without riot

import { format } from 'riot-format'
let formatter = format(new Date(), 'date', 'yyyy-mm-dd')
console.log(formatter.current)
//Note: formatter.current is lazily evaluated until you access it

For more information, see Get Started

More

Plans

  • add currency support

License

MIT

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.1.3

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago