app-base-react
Version:
react development common base package.
1 lines • 784 B
JavaScript
;module.exports={formatSize:function(t){t=parseFloat(t,2);return t<1024?t.toFixed(2)+"B":t<1048576?(t/1024).toFixed(2)+"KB":t<1073741824?(t/1024/1024).toFixed(2)+"MB":"0B"},getExt:function(t){var e;return-1===t.lastIndexOf(".")?t:(e=t.lastIndexOf(".")+1,t.substring(e,t.length).toLowerCase())},getName:function(t){var e=t.lastIndexOf(".");return-1===e?t:t.substring(0,e)},getFileName:function(t){t=t.split("/");return t[t.length-1]},isImageFile:function(t){return/(gif|jpg|jpeg|png|GIF|JPG|PNG)$/gi.test(t)},isVideoFile:function(t){return/(mp4|mp3|flv|wav)$/gi.test(t)},isDocumentFile:function(t){return/(doc|docx|xls|xlsx|pdf|txt|ppt|pptx|rar|zip|html|jsp|sql|htm|shtml|xml)$/gi.test(t)},isOfficeFile:function(t){return/(doc|docx|xls|xlsx|pdf|txt|ppt|pptx)$/gi.test(t)}};