UNPKG

libs-js

Version:

零散的工具函数,无依赖

2 lines (1 loc) 6.58 kB
"use strict";function createCommonjsModule(t,e){return t(e={exports:{}},e.exports),e.exports}var _global=createCommonjsModule(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),_core=createCommonjsModule(function(t){var e=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=e)}),_core_1=_core.version,_isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},_anObject=function(t){if(!_isObject(t))throw TypeError(t+" is not an object!");return t},_fails=function(t){try{return!!t()}catch(t){return!0}},_descriptors=!_fails(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),document=_global.document,is=_isObject(document)&&_isObject(document.createElement),_domCreate=function(t){return is?document.createElement(t):{}},_ie8DomDefine=!_descriptors&&!_fails(function(){return 7!=Object.defineProperty(_domCreate("div"),"a",{get:function(){return 7}}).a}),_toPrimitive=function(t,e){if(!_isObject(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!_isObject(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!_isObject(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!_isObject(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},dP=Object.defineProperty,f=_descriptors?Object.defineProperty:function(t,e,n){if(_anObject(t),e=_toPrimitive(e,!0),_anObject(n),_ie8DomDefine)try{return dP(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t},_objectDp={f:f},_propertyDesc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},_hide=_descriptors?function(t,e,n){return _objectDp.f(t,e,_propertyDesc(1,n))}:function(t,e,n){return t[e]=n,t},hasOwnProperty={}.hasOwnProperty,_has=function(t,e){return hasOwnProperty.call(t,e)},id=0,px=Math.random(),_uid=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++id+px).toString(36))},_shared=createCommonjsModule(function(t){var e="__core-js_shared__",n=_global[e]||(_global[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:_core.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),_functionToString=_shared("native-function-to-string",Function.toString),_redefine=createCommonjsModule(function(t){var i=_uid("src"),e="toString",c=(""+_functionToString).split(e);_core.inspectSource=function(t){return _functionToString.call(t)},(t.exports=function(t,e,n,r){var o="function"==typeof n;o&&(_has(n,"name")||_hide(n,"name",e)),t[e]!==n&&(o&&(_has(n,i)||_hide(n,i,t[e]?""+t[e]:c.join(String(e)))),t===_global?t[e]=n:r?t[e]?t[e]=n:_hide(t,e,n):(delete t[e],_hide(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[i]||_functionToString.call(this)})}),_aFunction=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},_ctx=function(r,o,t){if(_aFunction(r),void 0===o)return r;switch(t){case 1:return function(t){return r.call(o,t)};case 2:return function(t,e){return r.call(o,t,e)};case 3:return function(t,e,n){return r.call(o,t,e,n)}}return function(){return r.apply(o,arguments)}},PROTOTYPE="prototype",$export=function(t,e,n){var r,o,i,c,u=t&$export.F,a=t&$export.G,s=t&$export.S,f=t&$export.P,_=t&$export.B,l=a?_global:s?_global[e]||(_global[e]={}):(_global[e]||{})[PROTOTYPE],p=a?_core:_core[e]||(_core[e]={}),d=p[PROTOTYPE]||(p[PROTOTYPE]={});for(r in a&&(n=e),n)i=((o=!u&&l&&void 0!==l[r])?l:n)[r],c=_&&o?_ctx(i,_global):f&&"function"==typeof i?_ctx(Function.call,i):i,l&&_redefine(l,r,i,t&$export.U),p[r]!=i&&_hide(p,r,c),f&&d[r]!=i&&(d[r]=i)};_global.core=_core,$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128;var _export=$export,toString={}.toString,_cof=function(t){return toString.call(t).slice(8,-1)},_iobject=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==_cof(t)?t.split(""):Object(t)},_defined=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},_toIobject=function(t){return _iobject(_defined(t))},ceil=Math.ceil,floor=Math.floor,_toInteger=function(t){return isNaN(t=+t)?0:(0<t?floor:ceil)(t)},min=Math.min,_toLength=function(t){return 0<t?min(_toInteger(t),9007199254740991):0},max=Math.max,min$1=Math.min,_toAbsoluteIndex=function(t,e){return(t=_toInteger(t))<0?max(t+e,0):min$1(t,e)},_arrayIncludes=function(u){return function(t,e,n){var r,o=_toIobject(t),i=_toLength(o.length),c=_toAbsoluteIndex(n,i);if(u&&e!=e){for(;c<i;)if((r=o[c++])!=r)return!0}else for(;c<i;c++)if((u||c in o)&&o[c]===e)return u||c||0;return!u&&-1}},shared=_shared("keys"),_sharedKey=function(t){return shared[t]||(shared[t]=_uid(t))},arrayIndexOf=_arrayIncludes(!1),IE_PROTO=_sharedKey("IE_PROTO"),_objectKeysInternal=function(t,e){var n,r=_toIobject(t),o=0,i=[];for(n in r)n!=IE_PROTO&&_has(r,n)&&i.push(n);for(;e.length>o;)_has(r,n=e[o++])&&(~arrayIndexOf(i,n)||i.push(n));return i},_enumBugKeys="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),_objectKeys=Object.keys||function(t){return _objectKeysInternal(t,_enumBugKeys)},f$1=Object.getOwnPropertySymbols,_objectGops={f:f$1},f$2={}.propertyIsEnumerable,_objectPie={f:f$2},_toObject=function(t){return Object(_defined(t))},$assign=Object.assign,_objectAssign=!$assign||_fails(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=$assign({},t)[n]||Object.keys($assign({},e)).join("")!=r})?function(t,e){for(var n=_toObject(t),r=arguments.length,o=1,i=_objectGops.f,c=_objectPie.f;o<r;)for(var u,a=_iobject(arguments[o++]),s=i?_objectKeys(a).concat(i(a)):_objectKeys(a),f=s.length,_=0;_<f;)u=s[_++],_descriptors&&!c.call(a,u)||(n[u]=a[u]);return n}:$assign;_export(_export.S+_export.F,"Object",{assign:_objectAssign});var _turn_seconds=function(t){var e={h:0,m:0,s:0};return(t=+t)<0||(e.h=parseInt(t/3600),e.m=parseInt(t/60)%60,e.s=t%60),e},countDown=function(t){var e,n,r=Object.assign({start:60,step:1e3,endCallBack:function(){}},t);return n=_turn_seconds(r.start),console.warn(n),"function"==typeof r.processCallBack&&r.processCallBack(n),e=setInterval(function(){r.start--,n=_turn_seconds(r.start),"function"==typeof r.processCallBack&&r.processCallBack(n),r.start<=0&&(clearInterval(e),"function"==typeof r.endCallBack&&r.endCallBack())},r.step)};module.exports=countDown;