jeremyruppel/walrus — pull request #24 by hershmire (2012-05-22 23:25:15+00:00)
Title: Currencies extension to filter a number to US dollar

Not sure if this is something you're interested in adding but I have a basic filter for making a number format to a US dollar. Tests are passing and I'm definitely open to further conversation on additions to this if you already had thoughts of your own creation.

Use example:

JSON data:
``` js
{
"car" : 36000,
"sandwich" : 9.25,
"icecream" : 5.99
}
```

Walrus template:
``` html

Car price (as is): {{car | :dollar}}

Car price (forced cents shown): {{car | :dollar( 0 )}}

Sandwich price (as is): {{sandwich | :dollar}}

Sandwich price (forced no cents shown): {{sandwich | :dollar( 0 )}}

Sandwich price (forced cents shown): {{sandwich | :dollar( 2 )}}

Icecream price (as is): {{icecream | :dollar}}

Icecream price (forced no cents shown): {{icecream | :dollar( 0 )}}

Icecream price (forced cents shown): {{icecream | :dollar( 2 )}}

```

HTML output:
``` html

Car price (as is): $36,000

Car price (forced cents shown): $36,000

Sandwich price (as is): $9.25

Sandwich price (forced no cents shown): $9

Sandwich price (forced cents shown): $9.25

Icecream price (as is): $5.99

Icecream price (forced no cents shown): $6

Icecream price (forced cents shown): $5.99

```