Skip to content

Instantly share code, notes, and snippets.

View joaolfern's full-sized avatar

João Fernandes joaolfern

  • FIT - Flextronics Institute of Technology
  • Sorocaba - SP, Brasil
  • 16:09 (UTC -03:00)
  • LinkedIn in/joaolfern
View GitHub Profile
@joaolfern
joaolfern / CountryCodesPT_BR.json
Last active January 20, 2025 19:19 — forked from anubhavshrimal/CountryCodes.json
JSON data containing country names (in Brazilian Portuguese) and their corresponding dialing codes (phone codes).
[
{
"name": "Afeganistão",
"dialCode": "+93",
"emoji": "🇦🇫",
"code": "AF"
},
{
"name": "África do Sul",
"dialCode": "+27",
@joaolfern
joaolfern / matchString.ts
Created August 2, 2024 14:20
Determine if two strings are equal, ignoring case differences and punctuation. Particularly useful for comparing words with Latin characters.
function escapeRegex(search: string) {
return search.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
}
function normalizeString(str: string) {
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
}
export function standardizeString(str: string) {
return escapeRegex(normalizeString(String(str)))