Skip to content

object replace

Subhajit Sahu edited this page May 5, 2020 · 1 revision

Replace parts of string using object.

const objectReplace = require('@extra-string/object-replace');
// objectReplace(<string>, <object>)

objectReplace('alpha beta', {'alpha': 'α', 'beta': 'β'});
// 'α β'
objectReplace('gamma DELTA', {'gamma': 'γ', 'delta': 'δ'});
// 'γ DELTA'
objectReplace('Epsilon ZETA'.toLowerCase(), {'epsilon': 'ε', 'zeta': 'ζ'});
// 'ε ζ'

extra-string

Clone this wiki locally