Merge pull request #1217 from umap-project/arobase-in-variable
Allow to use arobase in variables
This commit is contained in:
commit
04a36556bd
2 changed files with 10 additions and 1 deletions
|
@ -174,7 +174,7 @@ L.Util.greedyTemplate = (str, data, ignore) => {
|
|||
}
|
||||
|
||||
return str.replace(
|
||||
/\{ *([\w_\:\.\|]+)(?:\|("[^"]*"))? *\}/g,
|
||||
/\{ *([\w_\:\.\|@]+)(?:\|("[^"]*"))? *\}/g,
|
||||
(str, key, staticFallback) => {
|
||||
const vars = key.split('|')
|
||||
let value
|
||||
|
|
|
@ -236,6 +236,15 @@ describe('L.Util', function () {
|
|||
)
|
||||
})
|
||||
|
||||
it('should accept arobase', function () {
|
||||
assert.equal(
|
||||
L.Util.greedyTemplate('A phrase with a {@variable}.', {
|
||||
'@variable': 'value',
|
||||
}),
|
||||
'A phrase with a value.'
|
||||
)
|
||||
})
|
||||
|
||||
it('should replace even with ignore if key is found', function () {
|
||||
assert.equal(
|
||||
L.Util.greedyTemplate(
|
||||
|
|
Loading…
Reference in a new issue