Skip to content

Instantly share code, notes, and snippets.

@174n
Last active February 8, 2020 20:10
Show Gist options
  • Save 174n/82d2daccf810dd44f531770fa0ba54bf to your computer and use it in GitHub Desktop.
Save 174n/82d2daccf810dd44f531770fa0ba54bf to your computer and use it in GitHub Desktop.
Hash cyrilic phrases for better searching - still in development
const cyrilicWordsHash = phrase => phrase
.replace(/[^А-Яа-я0-9 ]/g,'')
.toUpperCase()
.split(" ")
.map(word => word.slice(0,1) + word.slice(1)
.replace(/А|Я|О|Ё|У|Ю|Ы|И|Э|Е/g, '')
).filter(word => word.length > 1);
export default cyrilicWordsHash;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment