Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/matthewmueller/subs

tiny string substitution
https://github.com/matthewmueller/subs

Last synced: about 1 month ago
JSON representation

tiny string substitution

Awesome Lists containing this project

README

        

# subs

tiny string substitution

## Installation

Install with [component(1)](http://component.io):

$ component install matthewmueller/subs

Install with npm:

$ npm install subs

## Example

```js
// subs(tpl, obj)
var tpl = 'my favorite {food} is: {name}';
var str = subs(str, { food: 'fruit', name: 'peach' });

// currying: subs(tpl)(obj)
var tpl = 'my favorite {food} is: {name}';
var fn = subs(tpl);
var str = fn({ food: 'fruit', name: 'peach' });
```

## Test

make test

## License

MIT