UNPKG

recoder-code

Version:

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

84 lines â€ĸ 2.34 kB
import { numberToLocale } from "../localize/index.js"; var formatDistanceLocale = { lessThanXSeconds: { one: 'āĻĒā§āϰāĻžā§Ÿ ā§§ āϏ⧇āϕ⧇āĻ¨ā§āĻĄ', other: 'āĻĒā§āϰāĻžā§Ÿ {{count}} āϏ⧇āϕ⧇āĻ¨ā§āĻĄ' }, xSeconds: { one: 'ā§§ āϏ⧇āϕ⧇āĻ¨ā§āĻĄ', other: '{{count}} āϏ⧇āϕ⧇āĻ¨ā§āĻĄ' }, halfAMinute: 'āφāϧ āĻŽāĻŋāύāĻŋāϟ', lessThanXMinutes: { one: 'āĻĒā§āϰāĻžā§Ÿ ā§§ āĻŽāĻŋāύāĻŋāϟ', other: 'āĻĒā§āϰāĻžā§Ÿ {{count}} āĻŽāĻŋāύāĻŋāϟ' }, xMinutes: { one: 'ā§§ āĻŽāĻŋāύāĻŋāϟ', other: '{{count}} āĻŽāĻŋāύāĻŋāϟ' }, aboutXHours: { one: 'āĻĒā§āϰāĻžā§Ÿ ā§§ āϘāĻ¨ā§āϟāĻž', other: 'āĻĒā§āϰāĻžā§Ÿ {{count}} āϘāĻ¨ā§āϟāĻž' }, xHours: { one: 'ā§§ āϘāĻ¨ā§āϟāĻž', other: '{{count}} āϘāĻ¨ā§āϟāĻž' }, xDays: { one: 'ā§§ āĻĻāĻŋāύ', other: '{{count}} āĻĻāĻŋāύ' }, aboutXWeeks: { one: 'āĻĒā§āϰāĻžā§Ÿ ā§§ āϏāĻĒā§āϤāĻžāĻš', other: 'āĻĒā§āϰāĻžā§Ÿ {{count}} āϏāĻĒā§āϤāĻžāĻš' }, xWeeks: { one: 'ā§§ āϏāĻĒā§āϤāĻžāĻš', other: '{{count}} āϏāĻĒā§āϤāĻžāĻš' }, aboutXMonths: { one: 'āĻĒā§āϰāĻžā§Ÿ ā§§ āĻŽāĻžāϏ', other: 'āĻĒā§āϰāĻžā§Ÿ {{count}} āĻŽāĻžāϏ' }, xMonths: { one: 'ā§§ āĻŽāĻžāϏ', other: '{{count}} āĻŽāĻžāϏ' }, aboutXYears: { one: 'āĻĒā§āϰāĻžā§Ÿ ā§§ āĻŦāĻ›āϰ', other: 'āĻĒā§āϰāĻžā§Ÿ {{count}} āĻŦāĻ›āϰ' }, xYears: { one: 'ā§§ āĻŦāĻ›āϰ', other: '{{count}} āĻŦāĻ›āϰ' }, overXYears: { one: 'ā§§ āĻŦāĻ›āϰ⧇āϰ āĻŦ⧇āĻļāĻŋ', other: '{{count}} āĻŦāĻ›āϰ⧇āϰ āĻŦ⧇āĻļāĻŋ' }, almostXYears: { one: 'āĻĒā§āϰāĻžā§Ÿ ā§§ āĻŦāĻ›āϰ', other: 'āĻĒā§āϰāĻžā§Ÿ {{count}} āĻŦāĻ›āϰ' } }; var formatDistance = function formatDistance(token, count, options) { var result; var tokenValue = formatDistanceLocale[token]; if (typeof tokenValue === 'string') { result = tokenValue; } else if (count === 1) { result = tokenValue.one; } else { result = tokenValue.other.replace('{{count}}', numberToLocale(count)); } if (options !== null && options !== void 0 && options.addSuffix) { if (options.comparison && options.comparison > 0) { return result + ' āĻāϰ āĻŽāĻ§ā§āϝ⧇'; } else { return result + ' āφāϗ⧇'; } } return result; }; export default formatDistance;