if (count === 1) { if (options !== null && options !== void 0 && options.addSuffix) { if (options.comparison && options.comparison > 0) { result = tokenValue.one.withPrepositionIn; } else { result = tokenValue.one.withPrepositionAgo; } } else { result = tokenValue.one.standalone; } } else if (count % 10 > 1 && count % 10 < 5 && // if last digit is between 2 and 4 String(count).substr(-2, 1) !== '1' // unless the 2nd to last digit is "1" ) { result = tokenValue.dual.replace('{{count}}', String(count)); } else { result = tokenValue.other.replace('{{count}}', String(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;