expand-template
Expand placeholders in a template string.
Install
$ npm i expand-template -S
Usage
Default functionality expands templates using {}
as separators for string placeholders.
var expand = var template = '{foo}/{foo}/{bar}/{bar}'console// -> BAR/BAR/FOO/FOO
Custom separators:
var expand = sep: '[]' var template = '[foo]/[foo]/[bar]/[bar]'console// -> BAR/BAR/FOO/FOO
License
All code, unless stated otherwise, is dual-licensed under WTFPL
and MIT
.