Skip to content

Instantly share code, notes, and snippets.

View rustamgarifulin's full-sized avatar
🕶️
rock fart

Rustam Garifulin rustamgarifulin

🕶️
rock fart
View GitHub Profile
const numfix = (n, t) => t[
(n %= 100, 20 > n && n > 4) ? 2
:[2,0,1,1,1,2][ (n %= 10, n < 5) ? n : 5]
]
;
const a = ['день','дня','дней'];
console.log(numfix(1, a)); // день
console.log(numfix(2, a)); // дня
console.log(numfix(5, a)); // дней

Keybase proof

I hereby claim:

  • I am rustamgarifulin on github.
  • I am rustamgarifulin (https://keybase.io/rustamgarifulin) on keybase.
  • I have a public key whose fingerprint is FC00 009D 4404 80D1 7734 46DB 06DC 6F3C B0B8 855F

To claim this, I am signing this object: