Skip to content

Instantly share code, notes, and snippets.

@oboshto
Created January 20, 2017 12:42
Show Gist options
  • Save oboshto/69678d930b41892e7e6bcf30f8ce503d to your computer and use it in GitHub Desktop.
Save oboshto/69678d930b41892e7e6bcf30f8ce503d to your computer and use it in GitHub Desktop.
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]
];
};
}
@oboshto
Copy link
Author

oboshto commented Mar 3, 2017

proschet(["жопка", "жопки", "жопок"])(1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment