mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
Implement some flow and cleanup API call for file manager
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// @flow
|
||||
import format from 'date-fns/format';
|
||||
|
||||
/**
|
||||
@@ -7,13 +8,13 @@ import format from 'date-fns/format';
|
||||
* @param {Number} bytes
|
||||
* @return {String}
|
||||
*/
|
||||
export function readableSize (bytes) {
|
||||
export function readableSize (bytes: number): string {
|
||||
if (Math.abs(bytes) < 1024) {
|
||||
return `${bytes} Bytes`;
|
||||
}
|
||||
|
||||
let u = -1;
|
||||
const units = ['KiB', 'MiB', 'GiB', 'TiB'];
|
||||
let u: number = -1;
|
||||
const units: Array<string> = ['KiB', 'MiB', 'GiB', 'TiB'];
|
||||
|
||||
do {
|
||||
bytes /= 1024;
|
||||
@@ -29,6 +30,6 @@ export function readableSize (bytes) {
|
||||
* @param {String} date
|
||||
* @return {String}
|
||||
*/
|
||||
export function formatDate (date) {
|
||||
export function formatDate (date: string): string {
|
||||
return format(date, 'MMM D, YYYY [at] HH:MM');
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user