Skip to content

Instantly share code, notes, and snippets.

@IOIO72
Created June 13, 2019 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IOIO72/6f736bd4fc176f59e6708bd37f92d322 to your computer and use it in GitHub Desktop.
Save IOIO72/6f736bd4fc176f59e6708bd37f92d322 to your computer and use it in GitHub Desktop.
Converts str input into string with Umlaut replacements
export const convertUmlauts = str => {
const charMap = {
'ä': 'ae',
'ö': 'oe',
'ü': 'ue',
'Ä': 'Ae',
'Ö': 'Oe',
'Ü': 'Ue',
'ß': 'ss'
};
return str.split('').map(c => (typeof charMap[c] === 'undefined') ? c : charMap[c]).join('');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment