Created
January 20, 2017 12:42
-
-
Save oboshto/69678d930b41892e7e6bcf30f8ce503d to your computer and use it in GitHub Desktop.
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 CASES = [2, 0, 1, 1, 1, 2]; | |
export default function proschet(titles) { | |
return function bindedProschet(amount) { | |
return titles[ | |
(amount % 100 > 4 && amount % 100 < 20) ? 2 : CASES[(amount % 10 < 5) ? amount % 10 : 5] | |
]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
proschet(["жопка", "жопки", "жопок"])(1)