1.0.3 • Published 6 years ago
mapped-replace v1.0.3
Mapped Replace
Given a string and an object, will replace all the keys of the object found in the string with the values of the object. TypeScript definitions are shipped with the package.
Examples
mappedReplace('test string', {}) // -> 'test string'
mappedReplace('foo', { 'foo': 'bar' }) // -> 'bar'
mappedReplace('foo bar baz', {
'foo': 'a',
'bar': 'b',
'baz': 'c'
}) // -> 'a b c'
mappedReplace('hello', { 'l': 'w', 'o': 'o uwu' }) // -> 'hewwo uwu'