UNPKG

@visulima/humanizer

Version:

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

33 lines (28 loc) 1.51 kB
'use strict'; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); const language_util_createDurationLanguage = require('./util/create-duration-language.cjs'); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); const getLithuanianForm = /* @__PURE__ */ __name((counter) => { if (counter === 1 || counter % 10 === 1 && counter % 100 > 20) { return 0; } if (Math.floor(counter) !== counter || counter % 10 >= 2 && counter % 100 > 20 || counter % 10 >= 2 && counter % 100 < 10) { return 1; } return 2; }, "getLithuanianForm"); const durationLanguage = language_util_createDurationLanguage( (counter) => counter % 10 === 0 || counter % 100 >= 10 && counter % 100 <= 20 ? "metų" : "metai", (counter) => ["mėnuo", "mėnesiai", "mėnesių"][getLithuanianForm(counter)], (counter) => ["savaitė", "savaitės", "savaičių"][getLithuanianForm(counter)], (counter) => ["diena", "dienos", "dienų"][getLithuanianForm(counter)], (counter) => ["valanda", "valandos", "valandų"][getLithuanianForm(counter)], (counter) => ["minutė", "minutės", "minučių"][getLithuanianForm(counter)], (counter) => ["sekundė", "sekundės", "sekundžių"][getLithuanianForm(counter)], (counter) => ["milisekundė", "milisekundės", "milisekundžių"][getLithuanianForm(counter)], "po %s", "prieš %s", "," ); exports.durationLanguage = durationLanguage;