Skip to content

Instantly share code, notes, and snippets.

@taiio
taiio / stringNormalize.js
Last active July 23, 2021 13:05
Remove accents(diacritics) in a string in Javascript( VietNam).
const stringNormalize = (str) => str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
// OR: ES2021 -> str.normalize('NFD').replace(/\p{Diacritic}/gu, '');
// "à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ|è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ|ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ"
//->"a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|e|e|e|e|e|e|e|e|e|e|e|o|o|o|o|o|o|o|o|o|o|o|o|o|o|o|o|o"
@taiio
taiio / nodejs-cheatsheet.js
Created June 6, 2020 04:18 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html