Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthewmueller/subs
tiny string substitution
https://github.com/matthewmueller/subs
Last synced: about 1 month ago
JSON representation
tiny string substitution
- Host: GitHub
- URL: https://github.com/matthewmueller/subs
- Owner: matthewmueller
- Created: 2013-10-21T21:28:24.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-20T23:42:57.000Z (over 9 years ago)
- Last Synced: 2024-04-08T20:10:14.024Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 169 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
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