String interpolation
Replaces the marked parts of a text with values from a given set, similar to a templating engine, but less robust.
Installation
npm install --save interpolate-string
Usage
const interpolate = ; const text = "Hello {{ name.first }}!";const data = name: first: "John" last: "Doe" ; const result = ; console; // Hello John!
Alternatively you can also specify a pattern for the replacement format:
const interpolate = ; const text = "Hello ${name.first}!";const pattern = /\$\{\}/g;const data = name: first: "John" last: "Doe" ; const result = ; console; // Hello John!