-
Notifications
You must be signed in to change notification settings - Fork 0
/
clod.min.js
2 lines (2 loc) · 1.85 KB
/
clod.min.js
1
2
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n=n||self,function(){var e=n.clod,o=n.clod=t();o.noConflict=function(){return n.clod=e,o}}())}(this,(function(){function n(n){return("function"==typeof n||e("Object")(n))&&!!n}function t(n){return null==n||(p(n)||r(n)||o(n)?0===n.length:0===Object.keys(n).length)}function e(n){return function(t){return toString.call(t)===`[object ${n}]`}}global._cdump=!1,global.cdump=function(n){_cdump&&console.log(n)};var o=e("Arguments"),r=e("String"),i=e("Module"),u=e("Function"),c=e("RegExp"),l=e("Number"),s=e("Null"),a=e("Boolean"),f=e("Date"),d=e("Undefined"),p=Array.isArray;const g=(()=>{const n={num:[..."0123456789"],alphaLower:[..."abcdefghijklmnopqrstuvwxyz"],alphaUpper:[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"],special:[..."~!@#$%^&*()_+-=[]{}|'\";:,./<>?"]};function*t(t,e){e.length<1&&(e=Object.values(n).flat());for(let n=0;n<t;n++)yield e[Math.random()*e.length|0]}return Object.assign((n,...e)=>[...t(n,e.flat())].join(""),n)})();return{__proto__:null,isNil:function(n){return null==n},isObject:n,isEmpty:t,isArguments:o,isString:r,isModule:i,isFunction:u,isRegExp:c,isNumber:l,isNull:s,isBoolean:a,isDate:f,isUndefined:d,isArray:p,first:function(e){if(n(e)&&!t(e))return Object.keys(e)[0]},keys:function(t){return n(t)?Object.keys(t):[]},random:function(n,t){return n=n&&(n>0||n<=15)?parseInt(n):12,Math.random().toString(t||10).substr(-n)},rand:function(n){return(n<0?-1:1)*Math.floor(Math.random()*Math.floor(Math.abs(n)))},replaceAt:function(n,t=0,e=0,o=""){return[n.substring(0,e),o,n.substring(e+t)].join("")},rnd:g,merge:function(){return!o(arguments)||t(arguments)?{}:Object.assign({},...arguments)},cap:function(n,t=!1){const e=n=>n.replace(/^./,n[0].toUpperCase());return t?n.split(" ").map(e).join(" "):e(n)}}}));
//# sourceMappingURL=clod.min.js.map