Last active
February 8, 2020 20:10
-
-
Save 174n/82d2daccf810dd44f531770fa0ba54bf to your computer and use it in GitHub Desktop.
Hash cyrilic phrases for better searching - still in development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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