npm.io
0.1.5 • Published 7 years ago

string-mapreplace

Licence
MIT
Version
0.1.5
Deps
0
Size
2 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

string-mapreplace

NOTE: string-mapreplace was renamed to @extra-string/map-replace. NPM

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, 'ζ'));
// 'ε ζ'

Keywords