1.0.3 • Published 6 years ago

mapped-replace v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Mapped Replace

build status Coverage Status npm version

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'