UNPKG

recoder-code

Version:

🚀 AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!

73 lines ‱ 1.84 kB
var translations = { about: 'körĂŒlbelĂŒl', over: 'több mint', almost: 'majdnem', lessthan: 'kevesebb mint' }; var withoutSuffixes = { xseconds: ' mĂĄsodperc', halfaminute: 'fĂ©l perc', xminutes: ' perc', xhours: ' Ăłra', xdays: ' nap', xweeks: ' hĂ©t', xmonths: ' hĂłnap', xyears: ' Ă©v' }; var withSuffixes = { xseconds: { '-1': ' mĂĄsodperccel ezelƑtt', '1': ' mĂĄsodperc mĂșlva', '0': ' mĂĄsodperce' }, halfaminute: { '-1': 'fĂ©l perccel ezelƑtt', '1': 'fĂ©l perc mĂșlva', '0': 'fĂ©l perce' }, xminutes: { '-1': ' perccel ezelƑtt', '1': ' perc mĂșlva', '0': ' perce' }, xhours: { '-1': ' ĂłrĂĄval ezelƑtt', '1': ' Ăłra mĂșlva', '0': ' ĂłrĂĄja' }, xdays: { '-1': ' nappal ezelƑtt', '1': ' nap mĂșlva', '0': ' napja' }, xweeks: { '-1': ' hĂ©ttel ezelƑtt', '1': ' hĂ©t mĂșlva', '0': ' hete' }, xmonths: { '-1': ' hĂłnappal ezelƑtt', '1': ' hĂłnap mĂșlva', '0': ' hĂłnapja' }, xyears: { '-1': ' Ă©vvel ezelƑtt', '1': ' Ă©v mĂșlva', '0': ' Ă©ve' } }; var formatDistance = function formatDistance(token, count, options) { var adverb = token.match(/about|over|almost|lessthan/i); var unit = adverb ? token.replace(adverb[0], '') : token; var addSuffix = (options === null || options === void 0 ? void 0 : options.addSuffix) === true; var key = unit.toLowerCase(); var comparison = (options === null || options === void 0 ? void 0 : options.comparison) || 0; var translated = addSuffix ? withSuffixes[key][comparison] : withoutSuffixes[key]; var result = key === 'halfaminute' ? translated : count + translated; if (adverb) { var adv = adverb[0].toLowerCase(); result = translations[adv] + ' ' + result; } return result; }; export default formatDistance;