UNPKG

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
"use strict"; 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;