@funboxteam/chronos
Advanced tools
Comparing version 3.1.0 to 3.2.0
# Changelog | ||
## 3.2.0 (30.09.2020) | ||
Removed @funboxteam/diamonds from the deps. Instead we inlined | ||
the only one fn used — `getPlural` in `getRelativeDate`. | ||
## 3.1.0 (28.09.2020) | ||
@@ -4,0 +10,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var diamonds_1 = require("@funboxteam/diamonds"); | ||
var _1 = require("."); | ||
@@ -24,17 +23,26 @@ var ensureDate_1 = require("./helpers/ensureDate"); | ||
else if (minutes < 60) { | ||
result = "" + (minutes === 1 ? '' : minutes + " ") + diamonds_1.getPlural(minutes, 'минуту', 'минуты', 'минут'); | ||
result = "" + (minutes === 1 ? '' : minutes + " ") + getPlural(minutes, 'минуту', 'минуты', 'минут'); | ||
} | ||
else if (hours < 24) { | ||
result = "" + (hours === 1 ? '' : hours + " ") + diamonds_1.getPlural(hours, 'час', 'часа', 'часов'); | ||
result = "" + (hours === 1 ? '' : hours + " ") + getPlural(hours, 'час', 'часа', 'часов'); | ||
} | ||
else if (days < 30) { | ||
result = "" + (days === 1 ? '' : days + " ") + diamonds_1.getPlural(days, 'день', 'дня', 'дней'); | ||
result = "" + (days === 1 ? '' : days + " ") + getPlural(days, 'день', 'дня', 'дней'); | ||
} | ||
else if (months < 12) { | ||
result = "" + (months === 1 ? '' : months + " ") + diamonds_1.getPlural(months, 'месяц', 'месяца', 'месяцев'); | ||
result = "" + (months === 1 ? '' : months + " ") + getPlural(months, 'месяц', 'месяца', 'месяцев'); | ||
} | ||
else { | ||
result = "" + (years === 1 ? '' : years + " ") + diamonds_1.getPlural(years, 'год', 'года', 'лет'); | ||
result = "" + (years === 1 ? '' : years + " ") + getPlural(years, 'год', 'года', 'лет'); | ||
} | ||
return result; | ||
}); | ||
function getPlural(n, one, few, many) { | ||
if (n % 10 === 1 && n % 100 !== 11) { | ||
return one; | ||
} | ||
if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)) { | ||
return few; | ||
} | ||
return many; | ||
} |
@@ -1,2 +0,1 @@ | ||
import { getPlural } from '@funboxteam/diamonds'; | ||
import { getDiffInDays, getDiffInHours, getDiffInMinutes, getDiffInMonths, getDiffInYears } from '.'; | ||
@@ -38,1 +37,10 @@ import { ensureDate } from './helpers/ensureDate'; | ||
}); | ||
function getPlural(n, one, few, many) { | ||
if (n % 10 === 1 && n % 100 !== 11) { | ||
return one; | ||
} | ||
if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)) { | ||
return few; | ||
} | ||
return many; | ||
} |
{ | ||
"name": "@funboxteam/chronos", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "One library to rule the time", | ||
@@ -30,8 +30,4 @@ "main": "dist/cjs/index.js", | ||
"start": "nodemon -e ts,js,json --exec 'npm test'", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
"dependencies": { | ||
"@funboxteam/diamonds": "6.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -63,3 +59,3 @@ "@funboxteam/eslint-config": "5.0.0", | ||
"lint-staged": { | ||
"lib/**/*.js": [ | ||
"lib/**/*.{js,ts}": [ | ||
"eslint --fix --cache -c .eslintrc.js" | ||
@@ -66,0 +62,0 @@ ], |
139364
0
2577
- Removed@funboxteam/diamonds@6.0.0
- Removed@funboxteam/diamonds@6.0.0(transitive)
- Removedtslib@2.0.0(transitive)