import React from 'react'
const utils = {
isObject: params => Object.prototype.toString.call(params) === '[object Object]',
isArray: params => Object.prototype.toString.call(params) === '[object Array]',
isFunction: params => Object.prototype.toString.call(params) === '[object Function]',
toSizeText: size => {
let num = 0
let unit = ''
if (size / 1024 < 1000) {
num = size / 1024
unit = 'KB'
} else if (size / 1024 / 1024 < 1000) {
num = size / 1024 / 1024
unit = 'MB'
} else {
num = size / 1024 / 1024 / 1024
unit = 'GB'
}
num = Math.floor(num * 100) / 100
return `${num}${unit}`
},
// 获取localStorage的已存容量
getLocalSurplus: () => {
if (!window.localStorage) {
console.log('浏览器不支持localStorage');