recoder-code
Version:
π AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!
104 lines (103 loc) β’ 2.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var formatDistanceLocale = {
lessThanXSeconds: {
one: '1η§ζͺζΊ',
other: '{{count}}η§ζͺζΊ',
oneWithSuffix: 'η΄1η§',
otherWithSuffix: 'η΄{{count}}η§'
},
xSeconds: {
one: '1η§',
other: '{{count}}η§'
},
halfAMinute: '30η§',
lessThanXMinutes: {
one: '1εζͺζΊ',
other: '{{count}}εζͺζΊ',
oneWithSuffix: 'η΄1ε',
otherWithSuffix: 'η΄{{count}}ε'
},
xMinutes: {
one: '1ε',
other: '{{count}}ε'
},
aboutXHours: {
one: 'η΄1ζι',
other: 'η΄{{count}}ζι'
},
xHours: {
one: '1ζι',
other: '{{count}}ζι'
},
xDays: {
one: '1ζ₯',
other: '{{count}}ζ₯'
},
aboutXWeeks: {
one: 'η΄1ι±ι',
other: 'η΄{{count}}ι±ι'
},
xWeeks: {
one: '1ι±ι',
other: '{{count}}ι±ι'
},
aboutXMonths: {
one: 'η΄1γζ',
other: 'η΄{{count}}γζ'
},
xMonths: {
one: '1γζ',
other: '{{count}}γζ'
},
aboutXYears: {
one: 'η΄1εΉ΄',
other: 'η΄{{count}}εΉ΄'
},
xYears: {
one: '1εΉ΄',
other: '{{count}}εΉ΄'
},
overXYears: {
one: '1εΉ΄δ»₯δΈ',
other: '{{count}}εΉ΄δ»₯δΈ'
},
almostXYears: {
one: '1εΉ΄θΏγ',
other: '{{count}}εΉ΄θΏγ'
}
};
var formatDistance = function formatDistance(token, count, options) {
options = options || {};
var result;
var tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === 'string') {
result = tokenValue;
} else if (count === 1) {
if (options.addSuffix && tokenValue.oneWithSuffix) {
result = tokenValue.oneWithSuffix;
} else {
result = tokenValue.one;
}
} else {
if (options.addSuffix && tokenValue.otherWithSuffix) {
result = tokenValue.otherWithSuffix.replace('{{count}}', String(count));
} else {
result = tokenValue.other.replace('{{count}}', String(count));
}
}
if (options.addSuffix) {
if (options.comparison && options.comparison > 0) {
return result + 'εΎ';
} else {
return result + 'ε';
}
}
return result;
};
var _default = formatDistance;
exports.default = _default;
module.exports = exports.default;