UNPKG

@visulima/humanizer

Version:

Humanizer is a library for humanizing data in a human-readable form.

32 lines (29 loc) 1.29 kB
import createDurationLanguage from './util/create-duration-language.mjs'; var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); const getPolishForm = /* @__PURE__ */ __name((counter) => { if (counter === 1) { return 0; } if (Math.floor(counter) !== counter) { return 1; } if (counter % 10 >= 2 && counter % 10 <= 4 && !(counter % 100 > 10 && counter % 100 < 20)) { return 2; } return 3; }, "getPolishForm"); const durationLanguage = createDurationLanguage( (counter) => ["rok", "roku", "lata", "lat"][getPolishForm(counter)], (counter) => ["miesiąc", "miesiąca", "miesiące", "miesięcy"][getPolishForm(counter)], (counter) => ["tydzień", "tygodnia", "tygodnie", "tygodni"][getPolishForm(counter)], (counter) => ["dzień", "dnia", "dni", "dni"][getPolishForm(counter)], (counter) => ["godzina", "godziny", "godziny", "godzin"][getPolishForm(counter)], (counter) => ["minuta", "minuty", "minuty", "minut"][getPolishForm(counter)], (counter) => ["sekunda", "sekundy", "sekundy", "sekund"][getPolishForm(counter)], (counter) => ["milisekunda", "milisekundy", "milisekundy", "milisekund"][getPolishForm(counter)], "za %s", "%s temu", "," ); export { durationLanguage };