-
Notifications
You must be signed in to change notification settings - Fork 6
Ruby-like simple string interpolation for Node.js
License
mvasilkov/rssi
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
rssi
----
Ruby-like simple string interpolation for Node.js
Installation
------------
npm install rssi
bower install rssi
wget http://bit.ly/getrssi -O rssi.js
Usage
-----
fmt(<template> [, <options>])
<template> = [string] template with embedded Ruby-style references
(e.g. "hello, #{thing}")
<options> = [object, optional] configures the generator function:
blank: [boolean: false] interpolator will remove non-substituted
references in output
noCache: [boolean: false] do NOT cache the interpolator function
(e.g. {blank: true})
Examples
--------
var hello = fmt('hello, #{thing}')
hello({thing: 'world'})
// -> hello, world
hello({thing: 'shawarma'})
// -> hello, shawarma
var goodbye = fmt('goodbye#{addon}, #{typeof}#{thing}', {blank: true});
goodbye({thing: 'world');
// -> goodbye, world
goodbye({thing: 'world', typeof: 'cruel ', addon: ' and good riddance'});
// -> goodbye and good riddance, cruel world
License
-------
MIT
About
Ruby-like simple string interpolation for Node.js
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published