@filerobot/utils
Advanced tools
Comparing version 0.0.0-beta.75 to 0.0.0-beta.76
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /* API change from file.url_permalink to file.url.permalink |
@@ -0,0 +0,0 @@ import { decode83 } from './base83'; |
@@ -0,0 +0,0 @@ import dataURItoBlob from './dataURItoBlob'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import { createAbortError } from './AbortController'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import NetworkError from '@filerobot/utils/lib/NetworkError'; |
@@ -0,0 +0,0 @@ import isDOMElement from './isDOMElement'; |
@@ -0,0 +0,0 @@ import isDOMElement from './isDOMElement'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import webkitGetAsEntryApi from './utils/webkitGetAsEntryApi/index'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import toArray from '../../../toArray'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -1,4 +0,27 @@ | ||
export default function humanReadableDate(date) { | ||
var dateEnding = function dateEnding(number) { | ||
return (Math.floor(number) > 1 ? 's' : '') + ' ago'; | ||
/** | ||
* @param {Date} date | ||
* @param {object} [translations] - Object with translations. Useful for external usage, for example for Hub. | ||
* @returns {string} - For example: "18 hours ago" | ||
*/ | ||
export default function humanReadableDate(date, translations) { | ||
if (translations === void 0) { | ||
translations = { | ||
ago: 'ago', | ||
second: 'second', | ||
seconds: 'seconds', | ||
minute: 'minute', | ||
minutes: 'minutes', | ||
hour: 'hour', | ||
hours: 'hours', | ||
day: 'day', | ||
days: 'days', | ||
month: 'month', | ||
months: 'months', | ||
year: 'year', | ||
years: 'years' | ||
}; | ||
} | ||
var timeAgo = function timeAgo(interval, periodMultiple, periodSingle) { | ||
return Math.floor(interval) + " " + (Math.floor(interval) > 1 ? periodMultiple : periodSingle) + " " + translations.ago; | ||
}; | ||
@@ -8,32 +31,12 @@ | ||
var interval = seconds / 31536000; | ||
if (interval > 1) { | ||
return Math.floor(interval) + " year" + dateEnding(interval); | ||
} | ||
if (interval > 1) return timeAgo(interval, translations.years, translations.year); | ||
interval = seconds / 2592000; | ||
if (interval > 1) { | ||
return Math.floor(interval) + " month" + dateEnding(interval); | ||
} | ||
if (interval > 1) return timeAgo(interval, translations.months, translations.month); | ||
interval = seconds / 86400; | ||
if (interval > 1) { | ||
return Math.floor(interval) + " day" + dateEnding(interval); | ||
} | ||
if (interval > 1) return timeAgo(interval, translations.days, translations.day); | ||
interval = seconds / 3600; | ||
if (interval > 1) { | ||
return Math.floor(interval) + " hour" + dateEnding(interval); | ||
} | ||
if (interval > 1) return timeAgo(interval, translations.hours, translations.hour); | ||
interval = seconds / 60; | ||
if (interval > 1) { | ||
return Math.floor(interval) + " minute" + dateEnding(interval); | ||
} | ||
return Math.floor(seconds) + " second" + dateEnding(interval); | ||
if (interval > 1) return timeAgo(interval, translations.minutes, translations.minute); | ||
return timeAgo(interval, translations.seconds, translations.second); | ||
} |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import checkFieldValidation from './checkFieldValidation'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } |
@@ -6,3 +6,3 @@ { | ||
"types": "types/index.d.ts", | ||
"version": "0.0.0-beta.75", | ||
"version": "0.0.0-beta.76", | ||
"files": [ | ||
@@ -15,3 +15,3 @@ "/dist", | ||
"dependencies": { | ||
"@filerobot/icons": "0.0.0-beta.75", | ||
"@filerobot/icons": "0.0.0-beta.76", | ||
"abortcontroller-polyfill": "^1.4.0", | ||
@@ -18,0 +18,0 @@ "lodash.throttle": "^4.1.1" |
@@ -0,0 +0,0 @@ # `@filerobot/utils` |
@@ -0,0 +0,0 @@ declare module '@filerobot/utils/lib/Translator' { |
@@ -0,0 +0,0 @@ // Can't get this to work correctly with `tsd` right now 🙃 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118091
2547
2
+ Added@filerobot/icons@0.0.0-beta.76(transitive)
- Removed@filerobot/icons@0.0.0-beta.75(transitive)