Simple template string interpolation.
The template string with {{variable}} placeholders.
An object with values to replace the placeholders.
The interpolated string.
// ES Moduleimport { template } from '@bnidev/js-utils'// CommonJSconst { template } = require('@bnidev/js-utils') Copy
// ES Moduleimport { template } from '@bnidev/js-utils'// CommonJSconst { template } = require('@bnidev/js-utils')
template('Hello {{name}}!', { name: 'World' }) // 'Hello World!'template('{{greeting}} {{name}}', { greeting: 'Hi', name: 'Alice' }) // 'Hi Alice' Copy
template('Hello {{name}}!', { name: 'World' }) // 'Hello World!'template('{{greeting}} {{name}}', { greeting: 'Hi', name: 'Alice' }) // 'Hi Alice'
Simple template string interpolation.