Skip to content

Instantly share code, notes, and snippets.

View GabrielShaad's full-sized avatar
👨‍💻

Gabriel Alexandre Lima Santos GabrielShaad

👨‍💻
  • Grupo Boticário
  • Curitiba, Brazil
  • 17:26 (UTC -03:00)
  • X @gabalexsan
View GitHub Profile
@GabrielShaad
GabrielShaad / filterList.js
Last active October 2, 2018 13:06
Filter list of objects to match normalized string and return an array of matches.
function _normalizeString(value) {
return value
.toString()
.replace(/á|ã|â/g, 'a')
.replace(/é|ê/g, 'e')
.replace(/í/g, 'i')
.replace(/ó|ô|õ/g, 'o')
.replace(/ú/g, 'u')
.replace(/ç/g, 'c')
.replace(/_/g, '');