package
Replaces placeholders into a string
npm install expand-placeholderGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Takes a string and interpolates the values.
$ npm i -S expand-placeholderconst expandPlaceholder = require('expand-placeholder');
const str = 'Hello from {{ country }}!';
const data {
country: 'Russia'
}
const expanded = expandPlaceholder(str, data);
console.log(expanded);
// => Hello from Russia!Takes a string and interpolates the values.
StringA string for processing.
ObjectData for the interpolation.
Object{
// String. Characters that define the beginning of a placeholder.
opening: '{{',
// String. Characters that define the end of a placeholder.
closing: '{{',
// Function. Allows to change a value before the insert into string.
transformValue: (val) => val
}See the Releases section of our GitHub project for changelogs for each release version.
This software is released under the terms of the MIT license.