![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | LICENSE | 39 years ago | 1.1K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | README.md | 39 years ago | 1.2K | f12eb36 documentaiton updates [كارل مبارك] |
![]() | index.js | 39 years ago | 672 | |
![]() | package.json | 2 years ago | 1.6K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | test.js | 39 years ago | 1.7K |
Expand placeholders in a template string.
$ npm i expand-template -S
Default functionality expands templates using {}
as separators for string placeholders.
var expand = require('expand-template')()
var template = '{foo}/{foo}/{bar}/{bar}'
console.log(expand(template, {
foo: 'BAR',
bar: 'FOO'
}))
// -> BAR/BAR/FOO/FOO
Custom separators:
var expand = require('expand-template')({ sep: '[]' })
var template = '[foo]/[foo]/[bar]/[bar]'
console.log(expand(template, {
foo: 'BAR',
bar: 'FOO'
}))
// -> BAR/BAR/FOO/FOO
All code, unless stated otherwise, is dual-licensed under WTFPL
and MIT
.