recoder-code
Version:
đ AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!
84 lines âĸ 2.34 kB
JavaScript
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;