@fifteen/design-system-vue
Version:
Vue 3 (Composition API + Typescript) implementation of the Fifteen Design System
2 lines (1 loc) • 1.86 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m={xseconds_other:"sekundė_sekundžių_sekundes",xminutes_one:"minutė_minutės_minutę",xminutes_other:"minutės_minučių_minutes",xhours_one:"valanda_valandos_valandą",xhours_other:"valandos_valandų_valandas",xdays_one:"diena_dienos_dieną",xdays_other:"dienos_dienų_dienas",xweeks_one:"savaitė_savaitės_savaitę",xweeks_other:"savaitės_savaičių_savaites",xmonths_one:"mėnuo_mėnesio_mėnesį",xmonths_other:"mėnesiai_mėnesių_mėnesius",xyears_one:"metai_metų_metus",xyears_other:"metai_metų_metus",about:"apie",over:"daugiau nei",almost:"beveik",lessthan:"mažiau nei"},h=(s,a,e,o)=>a?o?"kelių sekundžių":"kelias sekundes":"kelios sekundės",n=(s,a,e,o)=>a?o?i(e)[1]:i(e)[2]:i(e)[0],t=(s,a,e,o)=>{const u=s+" ";return s===1?u+n(s,a,e,o):a?o?u+i(e)[1]:u+(d(s)?i(e)[1]:i(e)[2]):u+(d(s)?i(e)[1]:i(e)[0])};function d(s){return s%10===0||s>10&&s<20}function i(s){return m[s].split("_")}const f={lessThanXSeconds:{one:h,other:t},xSeconds:{one:h,other:t},halfAMinute:"pusė minutės",lessThanXMinutes:{one:n,other:t},xMinutes:{one:n,other:t},aboutXHours:{one:n,other:t},xHours:{one:n,other:t},xDays:{one:n,other:t},aboutXWeeks:{one:n,other:t},xWeeks:{one:n,other:t},aboutXMonths:{one:n,other:t},xMonths:{one:n,other:t},aboutXYears:{one:n,other:t},xYears:{one:n,other:t},overXYears:{one:n,other:t},almostXYears:{one:n,other:t}},x=(s,a,e)=>{const o=s.match(/about|over|almost|lessthan/i),u=o?s.replace(o[0],""):s,l=e?.comparison!==void 0&&e.comparison>0;let r;const _=f[s];if(typeof _=="string"?r=_:a===1?r=_.one(a,e?.addSuffix===!0,u.toLowerCase()+"_one",l):r=_.other(a,e?.addSuffix===!0,u.toLowerCase()+"_other",l),o){const c=o[0].toLowerCase();r=m[c]+" "+r}return e?.addSuffix?e.comparison&&e.comparison>0?"po "+r:"prieš "+r:r};exports.formatDistance=x;