Last active
June 22, 2017 18:28
-
-
Save gearmobile/98978a987b5336b52a3bda664e556e6b to your computer and use it in GitHub Desktop.
Склонение существительных
This file contains hidden or 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
// methods | |
getNoun (number, singular, few, plural) { | |
number = Math.abs(number) | |
number %= 100 | |
if (number >= 5 && number <= 20) { | |
return plural | |
} | |
number %= 10; | |
if (number == 1) { | |
return singular | |
} | |
if (number >= 2 && number <= 4) { | |
return few | |
} | |
return plural | |
} | |
// template | |
<p>{{ count + ' ' + getNoun(count, 'окно', 'окна', 'окон') }}</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment