Skip to content

Instantly share code, notes, and snippets.

@ahultgren
Last active November 20, 2019 13:35
Show Gist options
  • Save ahultgren/5284223 to your computer and use it in GitHub Desktop.
Save ahultgren/5284223 to your computer and use it in GitHub Desktop.
A little helper to remove so called diacritics from latin characters (eg convert international characters to url-friendly ones). Please tell me if you find some missing characters or a way to make this more efficient.
"use strict";
var accents = 'àáäâæåèéëêęìíïîòóöôøœōõùúüûūýçñ',
normals = 'aaaaaaeeeeeiiiioooooooouuuuuycn',
diacriticsRegexp = new RegExp('[' + accents + ']', 'ig');
module.exports = exports = function undiacritics (string) {
return string.replace(diacriticsRegexp, function(s){
return normals[accents.indexOf(s)];
});
};
exports.addChars = function (accent, normal) {
accents += accent;
normals += normals;
};
@Riwaj123
Copy link

Here is a lot of variety by riwaj men's wear that you like to wear new dress design

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment