Created
May 28, 2019 02:53
-
-
Save jsdevjournal/c5cc713ff172d9e52b3458c164e505f1 to your computer and use it in GitHub Desktop.
formattedMessage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function formattedMessage(translation, object) { | |
let text = `${translation}` | |
Object.keys(object).forEach(key => | |
text = text.replace(`{${key}}`, object[key]) | |
) | |
return text | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment