0.1.5 • Published 6 years ago
string-mapreplace v0.1.5
string-mapreplace
NOTE: string-mapreplace was renamed to @extra-string/map-replace.
Replace parts of string using map.
const mapReplace = require('string-mapreplace');
// mapReplace(<string>, <map>)
mapReplace('alpha beta', new Map().set('alpha', 'α').set('beta', 'β'));
// 'α β'
mapReplace('gamma DELTA', new Map().set('gamma', 'γ').set('delta', 'δ'));
// 'γ DELTA'
mapReplace('Epsilon ZETA', new Map().set(/epsilon/gi, 'ε').set(/zeta/gi, 'ζ'));
// 'ε ζ'