adenovo-utils
Version:
util methods for adenovo
1 lines • 8.31 kB
JavaScript
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("adenovo-utils",[],t):"object"==typeof exports?exports["adenovo-utils"]=t():n["adenovo-utils"]=t()}(this,function(){return function(n){var t={};function r(e){if(t[e])return t[e].exports;var o=t[e]={i:e,l:!1,exports:{}};return n[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:e})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)r.d(e,o,function(t){return n[t]}.bind(null,o));return e},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=0)}([function(n,t,r){var e,o,u;o=[],void 0===(u="function"==typeof(e=function(){"use strict";var n=r(1),e=r(2),o=r(3),u=r(4);t.pid=n,t.functional=e,t.obj=o,t.log=u})?e.apply(t,o):e)||(n.exports=u)},function(n,t,r){var e,o,u;o=[],void 0===(u="function"==typeof(e=function(){"use strict";function n(n){return function(n){if(Array.isArray(n)){for(var t=0,r=new Array(n.length);t<n.length;t++)r[t]=n[t];return r}}(n)||function(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=new Map([["A","10"],["B","11"],["C","12"],["D","13"],["E","14"],["F","15"],["G","16"],["H","17"],["I","34"],["J","18"],["K","19"],["M","21"],["N","22"],["O","35"],["P","23"],["Q","24"],["T","27"],["U","28"],["V","29"],["W","32"],["X","30"],["Z","33"],["L","20"],["R","25"],["S","26"],["Y","31"]]),e=[1,9,8,7,6,5,4,3,2,1,1],o=function(t){if(10!==t.length)return{result:!1,msg:"身分證字號長度不正確"};if(!/^[A-Za-z][12]\d{8}/.test(t))return{result:!1,msg:"身分證格式錯誤"};var o=n(t),u=o[0],i=o.slice(1),c=n(r.get(u.toUpperCase())).concat(n(i)).map(function(n,t){return n*e[t]}).reduce(function(n,t){return n+t},0);return c%10!=0?{result:!1,msg:"驗證失敗"}:{result:!0}},u=n(r.keys()),i=[1,2],c=n(Array(10).keys()),f=n(Array(8).keys());t.checkPid=o,t.genPid=function n(){var t=u[Math.floor(Math.random()*u.length)],r=i[Math.floor(Math.random()*i.length)],e="".concat(t).concat(r).concat(function(){var n=[];return f.forEach(function(t){n.push(c[Math.floor(Math.random()*c.length)])}),n.reduce(function(n,t){return n.toString()+t.toString()},"")}());return o(e).result?e:n()}})?e.apply(t,o):e)||(n.exports=u)},function(n,t,r){var e,o,u;o=[],void 0===(u="function"==typeof(e=function(){"use strict";var n=function(n,t){return function(){return t(n.apply(void 0,arguments))}};t.pipe=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];return r.reduce(n)},t.pipeAsync=function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];return function(n){return t.reduce(function(n,t){return n.then(t)},Promise.resolve(n))}},t.compose=function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];return t.reduce(function(n,t){return function(){return n(t.apply(void 0,arguments))}})},t.composeAsync=function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(n,t){return n.then(t)},Promise.resolve(n))}},t.printLog=function(n){return console.log({source:n}),n}})?e.apply(t,o):e)||(n.exports=u)},function(n,t,r){var e,o,u;o=[],void 0===(u="function"==typeof(e=function(){"use strict";function n(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{},o=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(e).filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.forEach(function(t){r(n,t,e[t])})}return n}function r(n,t,r){return t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n}t.isEmpty=function(n){for(var t in n)if(n.hasOwnProperty(t))return!1;return!0},t.removeEmpty=function(t){return Object.keys(t).filter(function(n){return null!==t[n]&&void 0!==t[n]}).reduce(function(e,o){return n({},e,r({},o,t[o]))},{})},t.keyMirror=function(t){return t.map(function(n){return r({},n,n)}).reduce(function(t,r){return n({},t,r)},{})}})?e.apply(t,o):e)||(n.exports=u)},function(n,t,r){(function(r){var e,o,u;o=[],void 0===(u="function"==typeof(e=function(){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(t)}t.debugLog=function(n){return console.log("[debug] ".concat(n))};var e=function(n){return function(t){var r="start"===n?"Start":"End",e=JSON.stringify(t),o="".concat("Lambda Event ").concat(r,": ").concat(e);console.log(o)}};t.durationLog=e,t.startLog=function(n){return e("start")(n)},t.endLog=function(n){return e("end")(n)};var o=r.env.STAGE||"UNKNOWN_ENV",u=function(t){return function(r){return function(e){var u="".concat(o,",").concat(r,",").concat(t,","),i=e.group,c=e.method,f=e.data,a=void 0===f?"":f,l=e.memberId,s=void 0===l?null:l,p="object"===n(a)?JSON.stringify(a):a,d=null==s?"":"".concat(s,","),y="".concat(i,",").concat(c,",").concat(d).concat(p),g="".concat(u).concat(y);console.log(g)}}};t.actionLog=u;var i=function(n){return function(t){return u("handler")(n)(t)}};t.handlerLog=i,t.handlerLogDebug=function(n){return i("debug")(n)},t.handlerLogInfo=function(n){return i("info")(n)},t.handlerLogWarning=function(n){return i("warning")(n)},t.handlerLogError=function(n){return i("error")(n)};var c=function(n){return function(t){return u("model")(n)(t)}};t.modelLog=c,t.modelLogDebug=function(n){return c("debug")(n)},t.modelLogInfo=function(n){return c("info")(n)},t.modelLogWarning=function(n){return c("warning")(n)},t.modelLogError=function(n){return c("error")(n)},t.getLogPayload=function(n){return function(t){return function(r){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return{group:n,method:t,data:r,memberId:e}}}}}})?e.apply(t,o):e)||(n.exports=u)}).call(this,r(5))},function(n,t){var r,e,o=n.exports={};function u(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(n){if(r===setTimeout)return setTimeout(n,0);if((r===u||!r)&&setTimeout)return r=setTimeout,setTimeout(n,0);try{return r(n,0)}catch(t){try{return r.call(null,n,0)}catch(t){return r.call(this,n,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:u}catch(n){r=u}try{e="function"==typeof clearTimeout?clearTimeout:i}catch(n){e=i}}();var f,a=[],l=!1,s=-1;function p(){l&&f&&(l=!1,f.length?a=f.concat(a):s=-1,a.length&&d())}function d(){if(!l){var n=c(p);l=!0;for(var t=a.length;t;){for(f=a,a=[];++s<t;)f&&f[s].run();s=-1,t=a.length}f=null,l=!1,function(n){if(e===clearTimeout)return clearTimeout(n);if((e===i||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(n);try{e(n)}catch(t){try{return e.call(null,n)}catch(t){return e.call(this,n)}}}(n)}}function y(n,t){this.fun=n,this.array=t}function g(){}o.nextTick=function(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new y(n,t)),1!==a.length||l||c(d)},y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(n){return[]},o.binding=function(n){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(n){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])});