Implement some flow and cleanup API call for file manager

This commit is contained in:
Dane Everitt 2018-09-23 16:06:23 -07:00
parent c3ef290145
commit aee42df3ad
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 186 additions and 118 deletions

View file

@ -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