diff options
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/templates/template-renderer.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/js/templates/template-renderer.js b/ext/js/templates/template-renderer.js index 2db9e177..f72740d5 100644 --- a/ext/js/templates/template-renderer.js +++ b/ext/js/templates/template-renderer.js @@ -108,7 +108,9 @@ class TemplateRenderer { ['noop', this._noop.bind(this)], ['isMoraPitchHigh', this._isMoraPitchHigh.bind(this)], ['getKanaMorae', this._getKanaMorae.bind(this)], - ['typeof', this._getTypeof.bind(this)] + ['typeof', this._getTypeof.bind(this)], + ['join', this._join.bind(this)], + ['concat', this._concat.bind(this)] ]; for (const [name, helper] of helpers) { @@ -414,4 +416,16 @@ class TemplateRenderer { const value = (ii > 0 ? args[0] : args[ii].fn(context)); return typeof value; } + + _join(context, ...args) { + return args.length > 1 ? args.slice(1, args.length - 1).flat().join(args[0]) : ''; + } + + _concat(context, ...args) { + let result = ''; + for (let i = 0, ii = args.length - 1; i < ii; ++i) { + result += args[i]; + } + return result; + } } |