摘要:
function smartPromise(promise){ return promise.then(res=>([null,res])).catch((e)=>([e,null])); } async function task(){ const [errorA,fileA] = await s 阅读全文
摘要:
取整 var a = ~~2.33 //(四舍五入) var b= 2.55 | 0//上取整 var c= 2.33 >> 0//下取整 金钱格式化:1234567890 --> 1,234,567,890 var test1 = '1234567890' var format = test1.r 阅读全文
摘要:
function groupBy( array , id ) { let groups = {}; array.forEach( function( o ) { let group = JSON.stringify( o[id] ); groups[group] = groups[group] || 阅读全文