/* uglified */
const uuidV4=require("uuid/v4");module.exports={clone:e=>JSON.parse(JSON.stringify(e)),getUUID:()=>uuidV4().replace(/-/g,""),math(str){return parseFloat(eval(str).toFixed("4"))},isMobile:e=>/^[1][3,4,5,7,8][0-9]{9}$/.test(e),getInsertSql(e,t,r=!1){if(!e)throw new Error("缺少参数：Table");if(!t)throw new Error("缺少参数：sqlData");let o=[],s=[];for(let e in t)t.hasOwnProperty(e)&&(o.push(r?e.toLowerCase():e.replace(/([A-Z])/g,"_$1").toLowerCase()),"string"==typeof t[e]?s.push(`'${t[e]}'`):"number"==typeof t[e]?s.push(`${t[e]}`):"object"==typeof t[e]?null===t[e]?s.push("null"):s.push(`'${JSON.stringify(t[e])}'`):"boolean"==typeof t[e]?s.push(`${!0===t[e]?1:0}`):s.push("''"));return`INSERT INTO  ${e} (${o.join(",")}) VALUES (${s.join(",")})`},getUpdateSql(e,t,r){if(!e)throw new Error("缺少参数：Table");if(!r)throw new Error("缺少参数：where");let o=[];for(let e in t){let r="";r="string"==typeof t[e]?`'${t[e]}'`:"number"==typeof t[e]?`${t[e]}`:"object"==typeof t[e]?null===t[e]?"null":`'${JSON.stringify(t[e])}'`:"boolean"==typeof t[e]?`${!0===t[e]?1:0}`:"''",o.push(`${e.replace(/([A-Z])/g,"_$1").toLowerCase()}=${r}`)}let s=[];for(let e in r){let o="";"string"==typeof r[e]?o=`'${r[e]}'`:"number"==typeof t[e]?o=`${r[e]}`:"object"==typeof t[e]&&(o=`'${JSON.stringify(r[i])}'`),s.push(`${e.replace(/([A-Z])/g,"_$1").toLowerCase()}=${o}`)}if(!s)throw new Error("缺少参数：$where");return`UPDATE  ${e} SET ${o.join(",")} WHERE ${s.join(" AND ")}`}},Date.prototype.format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var r in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),t)new RegExp("("+r+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[r]:("00"+t[r]).substr((""+t[r]).length)));return e};