| 1 |
- function l(e,t){if(arguments.length===0||!e)return null;const r=t||"{y}-{m}-{d} {h}:{i}:{s}";let n;typeof e=="string"&&e.indexOf("/")&&(e=e.replace(/-/g,"/"),e=e.replace(/T/g," "),e=e.replace(/\.+\d{0,6}/,"")),typeof e=="object"?n=e:(typeof e=="string"&&(/^[0-9]+$/.test(e)?e=parseInt(e):e=e.replace(new RegExp(/-/gm),"/")),typeof e=="number"&&e.toString().length===10&&(e=e*1e3),n=new Date(e));const o={y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate(),h:n.getHours(),i:n.getMinutes(),s:n.getSeconds(),a:n.getDay()};return r.replace(/{([ymdhisa])+}/g,(a,u)=>{const c=o[u];return u==="a"?["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"][c]:c.toString().padStart(2,"0")})}const f=e=>(e/1024/1024).toFixed(2)+"MB",i=e=>e?e.indexOf("video")>-1?"video":e.indexOf("audio")>-1?"audio":e.indexOf("image")>-1?"image":"other":null;function g(e,t){return(e/t*100).toFixed(2)}function d(e=[]){function t(r){r.children&&Array.isArray(r.children)&&(r.children.sort((n,o)=>n.sort-o.sort),r.children.forEach(n=>{t(n)}))}e.sort((r,n)=>r.sort-n.sort);for(let r=0;r<e.length;r++)t(e[r])}function h(e,t){return e.reduce((r,n,o)=>{const s=Math.floor(o/t);return r[s]||(r[s]=[]),r[s].push(n),r},[])}function p(e,t){if(!e.length)return 0;const r=e.reduce((n,o)=>n+o[t],0);return console.log("sum",r),r/e.length}export{f as a,h as b,g as c,p as d,i as g,l as p,d as s};
|