New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chimee-helper-utils

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chimee-helper-utils - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

90

__tests__/index.js
import * as utils from 'index';
test('runRejectableQueue', async () => {
expect(utils.runRejectableQueue([])).resolves.toBe();
expect(utils.runRejectableQueue([1, 2, 3])).resolves.toBe();
expect(utils.runRejectableQueue([1, 2, false, 3])).rejects.toMatch('stop');
expect(utils.runRejectableQueue([
() => {},
() => {},
() => {}
])).resolves.toBe();
expect(utils.runRejectableQueue([
() => {},
Promise.resolve(),
() => new Promise(resolve => resolve())
])).resolves.toBe();
expect(utils.runRejectableQueue([
() => {},
Promise.reject(),
() => new Promise(resolve => resolve())
])).rejects.toMatch('stop');
expect(utils.runRejectableQueue([
() => {},
Promise.resolve(),
() => new Promise((resolve, reject) => reject())
])).rejects.toMatch('stop');
const checkArray = [];
await expect(utils.runRejectableQueue([
() => checkArray.push(1),
() => checkArray.push(2),
() => false,
() => checkArray.push(3),
() => checkArray.push(4),
])).rejects.toMatch('stop');
expect(checkArray).toEqual([1, 2]);
describe('runRejectableQueue', async () => {
test('empty', () => {
expect(utils.runRejectableQueue([])).resolves.toBe();
});
test('no function', () => {
expect(utils.runRejectableQueue([1, 2, 3])).resolves.toBe();
});
test('no function but has a false', () => {
expect(utils.runRejectableQueue([1, 2, false, 3])).rejects.toMatch('stop');
});
test('functions', () => {
expect(utils.runRejectableQueue([
() => {},
() => {},
() => {}
])).resolves.toBe();
});
test('functions and promise', () => {
expect(utils.runRejectableQueue([
() => {},
Promise.resolve(),
() => new Promise(resolve => resolve())
])).resolves.toBe();
});
test('function and promise.reject', () => {
expect(utils.runRejectableQueue([
() => {},
Promise.reject(),
() => new Promise(resolve => resolve())
])).rejects.toMatch('stop');
});
test('function return promise.reject', () => {
expect(utils.runRejectableQueue([
() => {},
Promise.resolve(),
() => new Promise((resolve, reject) => reject())
])).rejects.toMatch('stop');
});
test('order', async () => {
const checkArray = [];
await expect(utils.runRejectableQueue([
() => checkArray.push(1),
() => checkArray.push(2),
() => false,
() => checkArray.push(3),
() => checkArray.push(4),
])).rejects.toMatch('stop');
expect(checkArray).toEqual([1, 2]);
});
test('error catch', async () => {
const error = new Error('i am an error');
await expect(utils.runRejectableQueue([
() => {},
() => {},
() => {throw error;}
])).rejects.toBe(error);
});
});

@@ -37,0 +61,0 @@

/**
* chimee-helper-utils v0.1.2
* chimee-helper-utils v0.1.3
* (c) 2017 toxic-johann

@@ -52,15 +52,2 @@ * Released under MIT

}
// ********************** class operation ***************************
// class MixinBuilder {
// constructor (superclass) {
// this.superclass = superclass || class {};
// }
// with (...mixins) {
// return mixins.reduce((c, mixin) => mixin(c), this.superclass);
// }
// }
// export const mix = (superclass) => {
// return new MixinBuilder(superclass);
// };
/**

@@ -86,4 +73,4 @@ * run a queue one by one.If include function reject or return false it will stop

return step(index + 1);
}).catch(function () {
return reject('stop');
}).catch(function (err) {
return reject(err || 'stop');
});

@@ -135,4 +122,4 @@ };

* @param {string} key
* @param {Function} options.get
* @param {Function} options.set
* @param {Function} get
* @param {Function} set
* @param {String} prefix the origin data's prefix. We do not plan to save it by closure.

@@ -139,0 +126,0 @@ */

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.chimeeHelperUtils=t.chimeeHelperUtils||{})}(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){return void 0===t||null===t}function r(t){return Array.isArray(t)}function o(t){return"function"==typeof t}function i(t){return"number"==typeof t}function u(t){return"string"==typeof t||t instanceof String}function f(t){return"boolean"==typeof t}function a(t){return n(t)||f(t)||u(t)||i(t)}function c(t,e,n){if(a(t))throw TypeError("setFrozenAttr obj parameter can not be primitive type");if(!u(e))throw TypeError("setFrozenAttr key parameter must be String");Object.defineProperty(t,e,{value:n,configurable:!1,enumerable:!1,writable:!1})}function l(t,e,n){var r=t;if(e+n<r.length){for(;n--;)if(128!=(192&r[++e]))return!1;return!0}return!1}function s(t,e){var n=e,r=(t=""+(t||"")).length;return(((e=(e||r)-r)>0?t.repeat?"0".repeat(e):new Array(e+1).join("0"):"")+t).slice(0,n)}var p=Math.ceil,y=Math.floor,h=function(t){return isNaN(t=+t)?0:(t>0?y:p)(t)},d=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},m=e(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)}),v=e(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),g=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},b=function(t,e,n){if(g(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},w=function(t){return"object"==typeof t?null!==t:"function"==typeof t},S=function(t){if(!w(t))throw TypeError(t+" is not an object!");return t},O=function(t){try{return!!t()}catch(t){return!0}},_=!O(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),j=m.document,A=w(j)&&w(j.createElement),F=function(t){return A?j.createElement(t):{}},E=!_&&!O(function(){return 7!=Object.defineProperty(F("div"),"a",{get:function(){return 7}}).a}),M=function(t,e){if(!w(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!w(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!w(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!w(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},P=Object.defineProperty,T={f:_?Object.defineProperty:function(t,e,n){if(S(t),e=M(e,!0),S(n),E)try{return P(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}},C=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},k=_?function(t,e,n){return T.f(t,e,C(1,n))}:function(t,e,n){return t[e]=n,t},x=function(t,e,n){var r,o,i,u=t&x.F,f=t&x.G,a=t&x.S,c=t&x.P,l=t&x.B,s=t&x.W,p=f?v:v[e]||(v[e]={}),y=p.prototype,h=f?m:a?m[e]:(m[e]||{}).prototype;f&&(n=e);for(r in n)(o=!u&&h&&void 0!==h[r])&&r in p||(i=o?h[r]:n[r],p[r]=f&&"function"!=typeof h[r]?n[r]:l&&o?b(i,m):s&&h[r]==i?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(i):c&&"function"==typeof i?b(Function.call,i):i,c&&((p.virtual||(p.virtual={}))[r]=i,t&x.R&&y&&!y[r]&&k(y,r,i)))};x.F=1,x.G=2,x.S=4,x.P=8,x.B=16,x.W=32,x.U=64,x.R=128;var N=x,R=k,I={}.hasOwnProperty,D=function(t,e){return I.call(t,e)},q={},z={}.toString,L=function(t){return z.call(t).slice(8,-1)},W=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==L(t)?t.split(""):Object(t)},G=function(t){return W(d(t))},U=Math.min,J=function(t){return t>0?U(h(t),9007199254740991):0},B=Math.max,H=Math.min,K=function(t,e){return(t=h(t))<0?B(t+e,0):H(t,e)},Q=m["__core-js_shared__"]||(m["__core-js_shared__"]={}),Y=function(t){return Q[t]||(Q[t]={})},$=0,V=Math.random(),X=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++$+V).toString(36))},Z=Y("keys"),tt=function(t){return Z[t]||(Z[t]=X(t))},et=function(t){return function(e,n,r){var o,i=G(e),u=J(i.length),f=K(r,u);if(t&&n!=n){for(;u>f;)if((o=i[f++])!=o)return!0}else for(;u>f;f++)if((t||f in i)&&i[f]===n)return t||f||0;return!t&&-1}}(!1),nt=tt("IE_PROTO"),rt=function(t,e){var n,r=G(t),o=0,i=[];for(n in r)n!=nt&&D(r,n)&&i.push(n);for(;e.length>o;)D(r,n=e[o++])&&(~et(i,n)||i.push(n));return i},ot="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),it=Object.keys||function(t){return rt(t,ot)},ut=_?Object.defineProperties:function(t,e){S(t);for(var n,r=it(e),o=r.length,i=0;o>i;)T.f(t,n=r[i++],e[n]);return t},ft=m.document&&document.documentElement,at=tt("IE_PROTO"),ct=function(){},lt=function(){var t,e=F("iframe"),n=ot.length;for(e.style.display="none",ft.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),lt=t.F;n--;)delete lt.prototype[ot[n]];return lt()},st=Object.create||function(t,e){var n;return null!==t?(ct.prototype=S(t),n=new ct,ct.prototype=null,n[at]=t):n=lt(),void 0===e?n:ut(n,e)},pt=e(function(t){var e=Y("wks"),n=m.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:X)("Symbol."+t))}).store=e}),yt=T.f,ht=pt("toStringTag"),dt=function(t,e,n){t&&!D(t=n?t:t.prototype,ht)&&yt(t,ht,{configurable:!0,value:e})},mt={};k(mt,pt("iterator"),function(){return this});var vt=function(t,e,n){t.prototype=st(mt,{next:C(1,n)}),dt(t,e+" Iterator")},gt=function(t){return Object(d(t))},bt=tt("IE_PROTO"),wt=Object.prototype,St=Object.getPrototypeOf||function(t){return t=gt(t),D(t,bt)?t[bt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?wt:null},Ot=pt("iterator"),_t=!([].keys&&"next"in[].keys()),jt=function(){return this},At=function(t,e,n,r,o,i,u){vt(n,e,r);var f,a,c,l=function(t){if(!_t&&t in h)return h[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},s=e+" Iterator",p="values"==o,y=!1,h=t.prototype,d=h[Ot]||h["@@iterator"]||o&&h[o],m=d||l(o),v=o?p?l("entries"):m:void 0,g="Array"==e?h.entries||d:d;if(g&&(c=St(g.call(new t)))!==Object.prototype&&dt(c,s,!0),p&&d&&"values"!==d.name&&(y=!0,m=function(){return d.call(this)}),u&&(_t||y||!h[Ot])&&k(h,Ot,m),q[e]=m,q[s]=jt,o)if(f={values:p?m:l("values"),keys:i?m:l("keys"),entries:v},u)for(a in f)a in h||R(h,a,f[a]);else N(N.P+N.F*(_t||y),e,f);return f},Ft=function(t){return function(e,n){var r,o,i=String(d(e)),u=h(n),f=i.length;return u<0||u>=f?t?"":void 0:(r=i.charCodeAt(u))<55296||r>56319||u+1===f||(o=i.charCodeAt(u+1))<56320||o>57343?t?i.charAt(u):r:t?i.slice(u,u+2):o-56320+(r-55296<<10)+65536}}(!0);At(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=Ft(e,n),this._i+=t.length,{value:t,done:!1})});var Et=function(){},Mt=function(t,e){return{value:e,done:!!t}};At(Array,"Array",function(t,e){this._t=G(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,Mt(1)):"keys"==e?Mt(0,n):"values"==e?Mt(0,t[n]):Mt(0,[n,t[n]])},"values");q.Arguments=q.Array,Et(),Et(),Et();for(var Pt=pt("toStringTag"),Tt=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],Ct=0;Ct<5;Ct++){var kt=Tt[Ct],xt=m[kt],Nt=xt&&xt.prototype;Nt&&!Nt[Pt]&&k(Nt,Pt,kt),q[kt]=q.Array}var Rt={f:pt},It=Rt.f("iterator"),Dt=e(function(t){t.exports={default:It,__esModule:!0}}),qt=e(function(t){var e=X("meta"),n=T.f,r=0,o=Object.isExtensible||function(){return!0},i=!O(function(){return o(Object.preventExtensions({}))}),u=function(t){n(t,e,{value:{i:"O"+ ++r,w:{}}})},f=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!w(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!D(t,e)){if(!o(t))return"F";if(!n)return"E";u(t)}return t[e].i},getWeak:function(t,n){if(!D(t,e)){if(!o(t))return!0;if(!n)return!1;u(t)}return t[e].w},onFreeze:function(t){return i&&f.NEED&&o(t)&&!D(t,e)&&u(t),t}}}),zt=T.f,Lt=function(t){var e=v.Symbol||(v.Symbol={});"_"==t.charAt(0)||t in e||zt(e,t,{value:Rt.f(t)})},Wt=function(t,e){for(var n,r=G(t),o=it(r),i=o.length,u=0;i>u;)if(r[n=o[u++]]===e)return n},Gt={f:Object.getOwnPropertySymbols},Ut={f:{}.propertyIsEnumerable},Jt=function(t){var e=it(t),n=Gt.f;if(n)for(var r,o=n(t),i=Ut.f,u=0;o.length>u;)i.call(t,r=o[u++])&&e.push(r);return e},Bt=Array.isArray||function(t){return"Array"==L(t)},Ht=ot.concat("length","prototype"),Kt={f:Object.getOwnPropertyNames||function(t){return rt(t,Ht)}},Qt=Kt.f,Yt={}.toString,$t="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Vt=function(t){try{return Qt(t)}catch(t){return $t.slice()}},Xt={f:function(t){return $t&&"[object Window]"==Yt.call(t)?Vt(t):Qt(G(t))}},Zt=Object.getOwnPropertyDescriptor,te={f:_?Zt:function(t,e){if(t=G(t),e=M(e,!0),E)try{return Zt(t,e)}catch(t){}if(D(t,e))return C(!Ut.f.call(t,e),t[e])}},ee=qt.KEY,ne=te.f,re=T.f,oe=Xt.f,ie=m.Symbol,ue=m.JSON,fe=ue&&ue.stringify,ae=pt("_hidden"),ce=pt("toPrimitive"),le={}.propertyIsEnumerable,se=Y("symbol-registry"),pe=Y("symbols"),ye=Y("op-symbols"),he=Object.prototype,de="function"==typeof ie,me=m.QObject,ve=!me||!me.prototype||!me.prototype.findChild,ge=_&&O(function(){return 7!=st(re({},"a",{get:function(){return re(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=ne(he,e);r&&delete he[e],re(t,e,n),r&&t!==he&&re(he,e,r)}:re,be=function(t){var e=pe[t]=st(ie.prototype);return e._k=t,e},we=de&&"symbol"==typeof ie.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof ie},Se=function(t,e,n){return t===he&&Se(ye,e,n),S(t),e=M(e,!0),S(n),D(pe,e)?(n.enumerable?(D(t,ae)&&t[ae][e]&&(t[ae][e]=!1),n=st(n,{enumerable:C(0,!1)})):(D(t,ae)||re(t,ae,C(1,{})),t[ae][e]=!0),ge(t,e,n)):re(t,e,n)},Oe=function(t,e){S(t);for(var n,r=Jt(e=G(e)),o=0,i=r.length;i>o;)Se(t,n=r[o++],e[n]);return t},_e=function(t){var e=le.call(this,t=M(t,!0));return!(this===he&&D(pe,t)&&!D(ye,t))&&(!(e||!D(this,t)||!D(pe,t)||D(this,ae)&&this[ae][t])||e)},je=function(t,e){if(t=G(t),e=M(e,!0),t!==he||!D(pe,e)||D(ye,e)){var n=ne(t,e);return!n||!D(pe,e)||D(t,ae)&&t[ae][e]||(n.enumerable=!0),n}},Ae=function(t){for(var e,n=oe(G(t)),r=[],o=0;n.length>o;)D(pe,e=n[o++])||e==ae||e==ee||r.push(e);return r},Fe=function(t){for(var e,n=t===he,r=oe(n?ye:G(t)),o=[],i=0;r.length>i;)!D(pe,e=r[i++])||n&&!D(he,e)||o.push(pe[e]);return o};de||(R((ie=function(){if(this instanceof ie)throw TypeError("Symbol is not a constructor!");var t=X(arguments.length>0?arguments[0]:void 0),e=function(n){this===he&&e.call(ye,n),D(this,ae)&&D(this[ae],t)&&(this[ae][t]=!1),ge(this,t,C(1,n))};return _&&ve&&ge(he,t,{configurable:!0,set:e}),be(t)}).prototype,"toString",function(){return this._k}),te.f=je,T.f=Se,Kt.f=Xt.f=Ae,Ut.f=_e,Gt.f=Fe,Rt.f=function(t){return be(pt(t))}),N(N.G+N.W+N.F*!de,{Symbol:ie});for(var Ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Me=0;Ee.length>Me;)pt(Ee[Me++]);for(var Ee=it(pt.store),Me=0;Ee.length>Me;)Lt(Ee[Me++]);N(N.S+N.F*!de,"Symbol",{for:function(t){return D(se,t+="")?se[t]:se[t]=ie(t)},keyFor:function(t){if(we(t))return Wt(se,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){ve=!0},useSimple:function(){ve=!1}}),N(N.S+N.F*!de,"Object",{create:function(t,e){return void 0===e?st(t):Oe(st(t),e)},defineProperty:Se,defineProperties:Oe,getOwnPropertyDescriptor:je,getOwnPropertyNames:Ae,getOwnPropertySymbols:Fe}),ue&&N(N.S+N.F*(!de||O(function(){var t=ie();return"[null]"!=fe([t])||"{}"!=fe({a:t})||"{}"!=fe(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!we(t)){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);return"function"==typeof(e=r[1])&&(n=e),!n&&Bt(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!we(e))return e}),r[1]=e,fe.apply(ue,r)}}}),ie.prototype[ce]||k(ie.prototype,ce,ie.prototype.valueOf),dt(ie,"Symbol"),dt(Math,"Math",!0),dt(m.JSON,"JSON",!0),Lt("asyncIterator"),Lt("observable");var Pe=v.Symbol,Te=e(function(t){t.exports={default:Pe,__esModule:!0}});e(function(t,e){function n(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=n(Dt),o=n(Te),i="function"==typeof o.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":typeof t};e.default="function"==typeof o.default&&"symbol"===i(r.default)?function(t){return void 0===t?"undefined":i(t)}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":void 0===t?"undefined":i(t)}});!function(t,e){var n=(v.Object||{})[t]||Object[t],r={};r[t]=e(n),N(N.S+N.F*O(function(){n(1)}),"Object",r)}("keys",function(){return function(t){return it(gt(t))}});var Ce=v.Object.keys,ke=(e(function(t){t.exports={default:Ce,__esModule:!0}}),Math.floor);N(N.S,"Number",{isInteger:function(t){return!w(t)&&isFinite(t)&&ke(t)===t}});var xe=v.Number.isInteger,Ne=(e(function(t){t.exports={default:xe,__esModule:!0}}),"\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"),Re="["+Ne+"]",Ie=RegExp("^"+Re+Re+"*"),De=RegExp(Re+Re+"*$"),qe=function(t,e,n){var r={},o=O(function(){return!!Ne[t]()||"​…"!="​…"[t]()}),i=r[t]=o?e(ze):Ne[t];n&&(r[n]=i),N(N.P+N.F*o,"String",r)},ze=qe.trim=function(t,e){return t=String(d(t)),1&e&&(t=t.replace(Ie,"")),2&e&&(t=t.replace(De,"")),t},Le=qe,We=m.parseFloat,Ge=Le.trim,Ue=1/We(Ne+"-0")!=-1/0?function(t){var e=Ge(String(t),3),n=We(e);return 0===n&&"-"==e.charAt(0)?-0:n}:We;N(N.S+N.F*(Number.parseFloat!=Ue),"Number",{parseFloat:Ue});var Je=parseFloat,Be=(e(function(t){t.exports={default:Je,__esModule:!0}}),function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}),He="undefined"!=typeof window&&"[object Object]"!==Object.prototype.toString.call(window),Ke=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return setTimeout(t,17)},Qe=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.oCancelAnimationFrame||function(t){clearTimeout(t)};t.inBrowser=He,t.makeArray=function(t){return Array.from(t)},t.transObjectAttrIntoArray=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t,e){return+t-+e};return Object.keys(t).sort(e).reduce(function(e,n){return e.concat(t[n])},[])},t.runRejectableQueue=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return new Promise(function(e,r){!function i(u){if(!(u>=t.length)){var f=o(t[u])?t[u].apply(t,Be(n)):t[u];return!1===f?r("stop"):Promise.resolve(f).then(function(){return i(u+1)}).catch(function(){return r("stop")})}e()}(0)})},t.runStoppableQueue=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function e(r){return r>=t.length||!1!==(o(t[r])?t[r].apply(t,Be(n)):t[r])&&e(++r)}(0)},t.setFrozenAttr=c,t.setAttrGetterAndSetter=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.get,i=n.set,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"__";if(a(t))throw TypeError("setFrozenAttr obj parameter can not be primitive type");if(!u(e))throw TypeError("setAttrGetterAndSetter key parameter must be String");var c=t[e];if(!o(r)&&(Object.defineProperty(t,f+e,{value:c,configurable:!0,writable:!0,enumerable:!1}),r=function(){return this[f+e]},i&&o(i))){var l=i;i=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];this[f+e]=l.call.apply(l,[this].concat(n))}}Object.defineProperty(t,e,{get:r,set:i})},t.decodeUTF8=function(t){for(var e=[],n=t,r=0,o=t.length;r<o;)if(n[r]<128)e.push(String.fromCharCode(n[r])),++r;else{if(n[r]<192);else if(n[r]<224){if(l(n,r,1)){var i=(31&n[r])<<6|63&n[r+1];if(i>=128){e.push(String.fromCharCode(65535&i)),r+=2;continue}}}else if(n[r]<240){if(l(n,r,2)){var u=(15&n[r])<<12|(63&n[r+1])<<6|63&n[r+2];if(u>=2048&&55296!=(63488&u)){e.push(String.fromCharCode(65535&u)),r+=3;continue}}}else if(n[r]<248&&l(n,r,3)){var f=(7&n[r])<<18|(63&n[r+1])<<12|(63&n[r+2])<<6|63&n[r+3];if(f>65536&&f<1114112){f-=65536,e.push(String.fromCharCode(f>>>10|55296)),e.push(String.fromCharCode(1023&f|56320)),r+=4;continue}}e.push(String.fromCharCode(65533)),++r}return e.join("")},t.debounce=function(t,e,n){var r=void 0,o=void 0,i=void 0,u=void 0,f=void 0,a=function a(){var c=new Date-u;c<e&&c>=0?r=setTimeout(a,e-c):(r=null,n||(f=t.apply(i,o),r||(i=o=null)))};return function(){i=this,o=arguments,u=new Date;var c=n&&!r;return r||(r=setTimeout(a,e)),c&&(f=t.apply(i,o),i=o=null),f}},t.throttle=function(t,e,n,r){var o=void 0,i=void 0,u=void 0,f=null,a=0;n||(n={});var c=function(){a=!1===n.leading?0:new Date-0,f=null,u=t.apply(o,i),f||(o=i=null)};return e=e||0,function(){var l=new Date;a||!1!==n.leading||(a=l);var s=e-(l-a);return o=r||this,i=arguments,s<=0||s>e?(f&&(clearTimeout(f),f=null),a=l,u=t.apply(o,i),f||(o=i=null)):f||!1===n.trailing||(f=setTimeout(c,s)),u}},t.raf=Ke,t.caf=Qe,t.strRepeat=s,t.formatTime=function(t){var e=Math.floor(t/3600);t=Math.floor(t%3600);var n=s(Math.floor(t/60),2),r=s(t=Math.floor(t%60),2);return e>=1?e+":"+n+":"+r:n+":"+r},t.addTransMethod=function(t){c(t,"trans",function(e){return t.__fns||c(t,"__fns",{}),t.__fns[e]||(t.__fns[e]=function(){if(!o(t[e]))throw TypeError("obj.trans(methodName) parameter must be Function");return t[e].apply(t,arguments)}),t.__fns[e]})},t.appendCSS=function(t){var e=document,n=e.querySelector("style");if(!n){n=e.createElement("style");var r=e.querySelector("head");r&&r.appendChild(n)}return n.appendChild(e.createTextNode(t)),n},t.formatDate=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd hh:mm:ss.i",n=t.getFullYear().toString(),r={M:t.getMonth()+1,d:t.getDate(),h:t.getHours(),m:t.getMinutes(),s:t.getSeconds(),i:t.getMilliseconds()};e=e.replace(/(y+)/gi,function(t,e){return n.substr(4-Math.min(4,e.length))});for(var o in r)!function(t){e=e.replace(new RegExp("("+t+"+)","g"),function(e,n){return(r[t]<10&&n.length>1?"0":"")+r[t]})}(o);return e},t.getLocalStorage=function(t){try{return window.localStorage.getItem(t)}catch(n){try{var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return r(e)?unescape(e[2]):""}catch(t){return""}}},t.setLocalStorage=function(t,e){try{window.localStorage.setItem(t,e)}catch(r){var n=new Date;n.setTime(n.getTime()+2592e7);try{document.cookie=t+"="+escape(e)+";expires="+n.toUTCString()+";path=/;"}catch(t){}}},Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.chimeeHelperUtils=t.chimeeHelperUtils||{})}(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){return void 0===t||null===t}function r(t){return Array.isArray(t)}function o(t){return"function"==typeof t}function i(t){return"number"==typeof t}function u(t){return"string"==typeof t||t instanceof String}function f(t){return"boolean"==typeof t}function a(t){return n(t)||f(t)||u(t)||i(t)}function c(t,e,n){if(a(t))throw TypeError("setFrozenAttr obj parameter can not be primitive type");if(!u(e))throw TypeError("setFrozenAttr key parameter must be String");Object.defineProperty(t,e,{value:n,configurable:!1,enumerable:!1,writable:!1})}function l(t,e,n){var r=t;if(e+n<r.length){for(;n--;)if(128!=(192&r[++e]))return!1;return!0}return!1}function s(t,e){var n=e,r=(t=""+(t||"")).length;return(((e=(e||r)-r)>0?t.repeat?"0".repeat(e):new Array(e+1).join("0"):"")+t).slice(0,n)}var p=Math.ceil,y=Math.floor,h=function(t){return isNaN(t=+t)?0:(t>0?y:p)(t)},d=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},m=e(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)}),v=e(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),g=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},b=function(t,e,n){if(g(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},w=function(t){return"object"==typeof t?null!==t:"function"==typeof t},S=function(t){if(!w(t))throw TypeError(t+" is not an object!");return t},O=function(t){try{return!!t()}catch(t){return!0}},_=!O(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),j=m.document,A=w(j)&&w(j.createElement),F=function(t){return A?j.createElement(t):{}},E=!_&&!O(function(){return 7!=Object.defineProperty(F("div"),"a",{get:function(){return 7}}).a}),M=function(t,e){if(!w(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!w(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!w(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!w(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},P=Object.defineProperty,T={f:_?Object.defineProperty:function(t,e,n){if(S(t),e=M(e,!0),S(n),E)try{return P(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}},C=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},k=_?function(t,e,n){return T.f(t,e,C(1,n))}:function(t,e,n){return t[e]=n,t},x=function(t,e,n){var r,o,i,u=t&x.F,f=t&x.G,a=t&x.S,c=t&x.P,l=t&x.B,s=t&x.W,p=f?v:v[e]||(v[e]={}),y=p.prototype,h=f?m:a?m[e]:(m[e]||{}).prototype;f&&(n=e);for(r in n)(o=!u&&h&&void 0!==h[r])&&r in p||(i=o?h[r]:n[r],p[r]=f&&"function"!=typeof h[r]?n[r]:l&&o?b(i,m):s&&h[r]==i?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(i):c&&"function"==typeof i?b(Function.call,i):i,c&&((p.virtual||(p.virtual={}))[r]=i,t&x.R&&y&&!y[r]&&k(y,r,i)))};x.F=1,x.G=2,x.S=4,x.P=8,x.B=16,x.W=32,x.U=64,x.R=128;var N=x,R=k,I={}.hasOwnProperty,D=function(t,e){return I.call(t,e)},q={},z={}.toString,L=function(t){return z.call(t).slice(8,-1)},W=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==L(t)?t.split(""):Object(t)},G=function(t){return W(d(t))},U=Math.min,J=function(t){return t>0?U(h(t),9007199254740991):0},B=Math.max,H=Math.min,K=function(t,e){return(t=h(t))<0?B(t+e,0):H(t,e)},Q=m["__core-js_shared__"]||(m["__core-js_shared__"]={}),Y=function(t){return Q[t]||(Q[t]={})},$=0,V=Math.random(),X=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++$+V).toString(36))},Z=Y("keys"),tt=function(t){return Z[t]||(Z[t]=X(t))},et=function(t){return function(e,n,r){var o,i=G(e),u=J(i.length),f=K(r,u);if(t&&n!=n){for(;u>f;)if((o=i[f++])!=o)return!0}else for(;u>f;f++)if((t||f in i)&&i[f]===n)return t||f||0;return!t&&-1}}(!1),nt=tt("IE_PROTO"),rt=function(t,e){var n,r=G(t),o=0,i=[];for(n in r)n!=nt&&D(r,n)&&i.push(n);for(;e.length>o;)D(r,n=e[o++])&&(~et(i,n)||i.push(n));return i},ot="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),it=Object.keys||function(t){return rt(t,ot)},ut=_?Object.defineProperties:function(t,e){S(t);for(var n,r=it(e),o=r.length,i=0;o>i;)T.f(t,n=r[i++],e[n]);return t},ft=m.document&&document.documentElement,at=tt("IE_PROTO"),ct=function(){},lt=function(){var t,e=F("iframe"),n=ot.length;for(e.style.display="none",ft.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),lt=t.F;n--;)delete lt.prototype[ot[n]];return lt()},st=Object.create||function(t,e){var n;return null!==t?(ct.prototype=S(t),n=new ct,ct.prototype=null,n[at]=t):n=lt(),void 0===e?n:ut(n,e)},pt=e(function(t){var e=Y("wks"),n=m.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:X)("Symbol."+t))}).store=e}),yt=T.f,ht=pt("toStringTag"),dt=function(t,e,n){t&&!D(t=n?t:t.prototype,ht)&&yt(t,ht,{configurable:!0,value:e})},mt={};k(mt,pt("iterator"),function(){return this});var vt=function(t,e,n){t.prototype=st(mt,{next:C(1,n)}),dt(t,e+" Iterator")},gt=function(t){return Object(d(t))},bt=tt("IE_PROTO"),wt=Object.prototype,St=Object.getPrototypeOf||function(t){return t=gt(t),D(t,bt)?t[bt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?wt:null},Ot=pt("iterator"),_t=!([].keys&&"next"in[].keys()),jt=function(){return this},At=function(t,e,n,r,o,i,u){vt(n,e,r);var f,a,c,l=function(t){if(!_t&&t in h)return h[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},s=e+" Iterator",p="values"==o,y=!1,h=t.prototype,d=h[Ot]||h["@@iterator"]||o&&h[o],m=d||l(o),v=o?p?l("entries"):m:void 0,g="Array"==e?h.entries||d:d;if(g&&(c=St(g.call(new t)))!==Object.prototype&&dt(c,s,!0),p&&d&&"values"!==d.name&&(y=!0,m=function(){return d.call(this)}),u&&(_t||y||!h[Ot])&&k(h,Ot,m),q[e]=m,q[s]=jt,o)if(f={values:p?m:l("values"),keys:i?m:l("keys"),entries:v},u)for(a in f)a in h||R(h,a,f[a]);else N(N.P+N.F*(_t||y),e,f);return f},Ft=function(t){return function(e,n){var r,o,i=String(d(e)),u=h(n),f=i.length;return u<0||u>=f?t?"":void 0:(r=i.charCodeAt(u))<55296||r>56319||u+1===f||(o=i.charCodeAt(u+1))<56320||o>57343?t?i.charAt(u):r:t?i.slice(u,u+2):o-56320+(r-55296<<10)+65536}}(!0);At(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=Ft(e,n),this._i+=t.length,{value:t,done:!1})});var Et=function(){},Mt=function(t,e){return{value:e,done:!!t}};At(Array,"Array",function(t,e){this._t=G(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,Mt(1)):"keys"==e?Mt(0,n):"values"==e?Mt(0,t[n]):Mt(0,[n,t[n]])},"values");q.Arguments=q.Array,Et(),Et(),Et();for(var Pt=pt("toStringTag"),Tt=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],Ct=0;Ct<5;Ct++){var kt=Tt[Ct],xt=m[kt],Nt=xt&&xt.prototype;Nt&&!Nt[Pt]&&k(Nt,Pt,kt),q[kt]=q.Array}var Rt={f:pt},It=Rt.f("iterator"),Dt=e(function(t){t.exports={default:It,__esModule:!0}}),qt=e(function(t){var e=X("meta"),n=T.f,r=0,o=Object.isExtensible||function(){return!0},i=!O(function(){return o(Object.preventExtensions({}))}),u=function(t){n(t,e,{value:{i:"O"+ ++r,w:{}}})},f=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!w(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!D(t,e)){if(!o(t))return"F";if(!n)return"E";u(t)}return t[e].i},getWeak:function(t,n){if(!D(t,e)){if(!o(t))return!0;if(!n)return!1;u(t)}return t[e].w},onFreeze:function(t){return i&&f.NEED&&o(t)&&!D(t,e)&&u(t),t}}}),zt=T.f,Lt=function(t){var e=v.Symbol||(v.Symbol={});"_"==t.charAt(0)||t in e||zt(e,t,{value:Rt.f(t)})},Wt=function(t,e){for(var n,r=G(t),o=it(r),i=o.length,u=0;i>u;)if(r[n=o[u++]]===e)return n},Gt={f:Object.getOwnPropertySymbols},Ut={f:{}.propertyIsEnumerable},Jt=function(t){var e=it(t),n=Gt.f;if(n)for(var r,o=n(t),i=Ut.f,u=0;o.length>u;)i.call(t,r=o[u++])&&e.push(r);return e},Bt=Array.isArray||function(t){return"Array"==L(t)},Ht=ot.concat("length","prototype"),Kt={f:Object.getOwnPropertyNames||function(t){return rt(t,Ht)}},Qt=Kt.f,Yt={}.toString,$t="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Vt=function(t){try{return Qt(t)}catch(t){return $t.slice()}},Xt={f:function(t){return $t&&"[object Window]"==Yt.call(t)?Vt(t):Qt(G(t))}},Zt=Object.getOwnPropertyDescriptor,te={f:_?Zt:function(t,e){if(t=G(t),e=M(e,!0),E)try{return Zt(t,e)}catch(t){}if(D(t,e))return C(!Ut.f.call(t,e),t[e])}},ee=qt.KEY,ne=te.f,re=T.f,oe=Xt.f,ie=m.Symbol,ue=m.JSON,fe=ue&&ue.stringify,ae=pt("_hidden"),ce=pt("toPrimitive"),le={}.propertyIsEnumerable,se=Y("symbol-registry"),pe=Y("symbols"),ye=Y("op-symbols"),he=Object.prototype,de="function"==typeof ie,me=m.QObject,ve=!me||!me.prototype||!me.prototype.findChild,ge=_&&O(function(){return 7!=st(re({},"a",{get:function(){return re(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=ne(he,e);r&&delete he[e],re(t,e,n),r&&t!==he&&re(he,e,r)}:re,be=function(t){var e=pe[t]=st(ie.prototype);return e._k=t,e},we=de&&"symbol"==typeof ie.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof ie},Se=function(t,e,n){return t===he&&Se(ye,e,n),S(t),e=M(e,!0),S(n),D(pe,e)?(n.enumerable?(D(t,ae)&&t[ae][e]&&(t[ae][e]=!1),n=st(n,{enumerable:C(0,!1)})):(D(t,ae)||re(t,ae,C(1,{})),t[ae][e]=!0),ge(t,e,n)):re(t,e,n)},Oe=function(t,e){S(t);for(var n,r=Jt(e=G(e)),o=0,i=r.length;i>o;)Se(t,n=r[o++],e[n]);return t},_e=function(t){var e=le.call(this,t=M(t,!0));return!(this===he&&D(pe,t)&&!D(ye,t))&&(!(e||!D(this,t)||!D(pe,t)||D(this,ae)&&this[ae][t])||e)},je=function(t,e){if(t=G(t),e=M(e,!0),t!==he||!D(pe,e)||D(ye,e)){var n=ne(t,e);return!n||!D(pe,e)||D(t,ae)&&t[ae][e]||(n.enumerable=!0),n}},Ae=function(t){for(var e,n=oe(G(t)),r=[],o=0;n.length>o;)D(pe,e=n[o++])||e==ae||e==ee||r.push(e);return r},Fe=function(t){for(var e,n=t===he,r=oe(n?ye:G(t)),o=[],i=0;r.length>i;)!D(pe,e=r[i++])||n&&!D(he,e)||o.push(pe[e]);return o};de||(R((ie=function(){if(this instanceof ie)throw TypeError("Symbol is not a constructor!");var t=X(arguments.length>0?arguments[0]:void 0),e=function(n){this===he&&e.call(ye,n),D(this,ae)&&D(this[ae],t)&&(this[ae][t]=!1),ge(this,t,C(1,n))};return _&&ve&&ge(he,t,{configurable:!0,set:e}),be(t)}).prototype,"toString",function(){return this._k}),te.f=je,T.f=Se,Kt.f=Xt.f=Ae,Ut.f=_e,Gt.f=Fe,Rt.f=function(t){return be(pt(t))}),N(N.G+N.W+N.F*!de,{Symbol:ie});for(var Ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Me=0;Ee.length>Me;)pt(Ee[Me++]);for(var Ee=it(pt.store),Me=0;Ee.length>Me;)Lt(Ee[Me++]);N(N.S+N.F*!de,"Symbol",{for:function(t){return D(se,t+="")?se[t]:se[t]=ie(t)},keyFor:function(t){if(we(t))return Wt(se,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){ve=!0},useSimple:function(){ve=!1}}),N(N.S+N.F*!de,"Object",{create:function(t,e){return void 0===e?st(t):Oe(st(t),e)},defineProperty:Se,defineProperties:Oe,getOwnPropertyDescriptor:je,getOwnPropertyNames:Ae,getOwnPropertySymbols:Fe}),ue&&N(N.S+N.F*(!de||O(function(){var t=ie();return"[null]"!=fe([t])||"{}"!=fe({a:t})||"{}"!=fe(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!we(t)){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);return"function"==typeof(e=r[1])&&(n=e),!n&&Bt(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!we(e))return e}),r[1]=e,fe.apply(ue,r)}}}),ie.prototype[ce]||k(ie.prototype,ce,ie.prototype.valueOf),dt(ie,"Symbol"),dt(Math,"Math",!0),dt(m.JSON,"JSON",!0),Lt("asyncIterator"),Lt("observable");var Pe=v.Symbol,Te=e(function(t){t.exports={default:Pe,__esModule:!0}});e(function(t,e){function n(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=n(Dt),o=n(Te),i="function"==typeof o.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":typeof t};e.default="function"==typeof o.default&&"symbol"===i(r.default)?function(t){return void 0===t?"undefined":i(t)}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":void 0===t?"undefined":i(t)}});!function(t,e){var n=(v.Object||{})[t]||Object[t],r={};r[t]=e(n),N(N.S+N.F*O(function(){n(1)}),"Object",r)}("keys",function(){return function(t){return it(gt(t))}});var Ce=v.Object.keys,ke=(e(function(t){t.exports={default:Ce,__esModule:!0}}),Math.floor);N(N.S,"Number",{isInteger:function(t){return!w(t)&&isFinite(t)&&ke(t)===t}});var xe=v.Number.isInteger,Ne=(e(function(t){t.exports={default:xe,__esModule:!0}}),"\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"),Re="["+Ne+"]",Ie=RegExp("^"+Re+Re+"*"),De=RegExp(Re+Re+"*$"),qe=function(t,e,n){var r={},o=O(function(){return!!Ne[t]()||"​…"!="​…"[t]()}),i=r[t]=o?e(ze):Ne[t];n&&(r[n]=i),N(N.P+N.F*o,"String",r)},ze=qe.trim=function(t,e){return t=String(d(t)),1&e&&(t=t.replace(Ie,"")),2&e&&(t=t.replace(De,"")),t},Le=qe,We=m.parseFloat,Ge=Le.trim,Ue=1/We(Ne+"-0")!=-1/0?function(t){var e=Ge(String(t),3),n=We(e);return 0===n&&"-"==e.charAt(0)?-0:n}:We;N(N.S+N.F*(Number.parseFloat!=Ue),"Number",{parseFloat:Ue});var Je=parseFloat,Be=(e(function(t){t.exports={default:Je,__esModule:!0}}),function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}),He="undefined"!=typeof window&&"[object Object]"!==Object.prototype.toString.call(window),Ke=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return setTimeout(t,17)},Qe=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.oCancelAnimationFrame||function(t){clearTimeout(t)};t.inBrowser=He,t.makeArray=function(t){return Array.from(t)},t.transObjectAttrIntoArray=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t,e){return+t-+e};return Object.keys(t).sort(e).reduce(function(e,n){return e.concat(t[n])},[])},t.runRejectableQueue=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return new Promise(function(e,r){!function i(u){if(!(u>=t.length)){var f=o(t[u])?t[u].apply(t,Be(n)):t[u];return!1===f?r("stop"):Promise.resolve(f).then(function(){return i(u+1)}).catch(function(t){return r(t||"stop")})}e()}(0)})},t.runStoppableQueue=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function e(r){return r>=t.length||!1!==(o(t[r])?t[r].apply(t,Be(n)):t[r])&&e(++r)}(0)},t.setFrozenAttr=c,t.setAttrGetterAndSetter=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.get,i=n.set,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"__";if(a(t))throw TypeError("setFrozenAttr obj parameter can not be primitive type");if(!u(e))throw TypeError("setAttrGetterAndSetter key parameter must be String");var c=t[e];if(!o(r)&&(Object.defineProperty(t,f+e,{value:c,configurable:!0,writable:!0,enumerable:!1}),r=function(){return this[f+e]},i&&o(i))){var l=i;i=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];this[f+e]=l.call.apply(l,[this].concat(n))}}Object.defineProperty(t,e,{get:r,set:i})},t.decodeUTF8=function(t){for(var e=[],n=t,r=0,o=t.length;r<o;)if(n[r]<128)e.push(String.fromCharCode(n[r])),++r;else{if(n[r]<192);else if(n[r]<224){if(l(n,r,1)){var i=(31&n[r])<<6|63&n[r+1];if(i>=128){e.push(String.fromCharCode(65535&i)),r+=2;continue}}}else if(n[r]<240){if(l(n,r,2)){var u=(15&n[r])<<12|(63&n[r+1])<<6|63&n[r+2];if(u>=2048&&55296!=(63488&u)){e.push(String.fromCharCode(65535&u)),r+=3;continue}}}else if(n[r]<248&&l(n,r,3)){var f=(7&n[r])<<18|(63&n[r+1])<<12|(63&n[r+2])<<6|63&n[r+3];if(f>65536&&f<1114112){f-=65536,e.push(String.fromCharCode(f>>>10|55296)),e.push(String.fromCharCode(1023&f|56320)),r+=4;continue}}e.push(String.fromCharCode(65533)),++r}return e.join("")},t.debounce=function(t,e,n){var r=void 0,o=void 0,i=void 0,u=void 0,f=void 0,a=function a(){var c=new Date-u;c<e&&c>=0?r=setTimeout(a,e-c):(r=null,n||(f=t.apply(i,o),r||(i=o=null)))};return function(){i=this,o=arguments,u=new Date;var c=n&&!r;return r||(r=setTimeout(a,e)),c&&(f=t.apply(i,o),i=o=null),f}},t.throttle=function(t,e,n,r){var o=void 0,i=void 0,u=void 0,f=null,a=0;n||(n={});var c=function(){a=!1===n.leading?0:new Date-0,f=null,u=t.apply(o,i),f||(o=i=null)};return e=e||0,function(){var l=new Date;a||!1!==n.leading||(a=l);var s=e-(l-a);return o=r||this,i=arguments,s<=0||s>e?(f&&(clearTimeout(f),f=null),a=l,u=t.apply(o,i),f||(o=i=null)):f||!1===n.trailing||(f=setTimeout(c,s)),u}},t.raf=Ke,t.caf=Qe,t.strRepeat=s,t.formatTime=function(t){var e=Math.floor(t/3600);t=Math.floor(t%3600);var n=s(Math.floor(t/60),2),r=s(t=Math.floor(t%60),2);return e>=1?e+":"+n+":"+r:n+":"+r},t.addTransMethod=function(t){c(t,"trans",function(e){return t.__fns||c(t,"__fns",{}),t.__fns[e]||(t.__fns[e]=function(){if(!o(t[e]))throw TypeError("obj.trans(methodName) parameter must be Function");return t[e].apply(t,arguments)}),t.__fns[e]})},t.appendCSS=function(t){var e=document,n=e.querySelector("style");if(!n){n=e.createElement("style");var r=e.querySelector("head");r&&r.appendChild(n)}return n.appendChild(e.createTextNode(t)),n},t.formatDate=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd hh:mm:ss.i",n=t.getFullYear().toString(),r={M:t.getMonth()+1,d:t.getDate(),h:t.getHours(),m:t.getMinutes(),s:t.getSeconds(),i:t.getMilliseconds()};e=e.replace(/(y+)/gi,function(t,e){return n.substr(4-Math.min(4,e.length))});for(var o in r)!function(t){e=e.replace(new RegExp("("+t+"+)","g"),function(e,n){return(r[t]<10&&n.length>1?"0":"")+r[t]})}(o);return e},t.getLocalStorage=function(t){try{return window.localStorage.getItem(t)}catch(n){try{var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return r(e)?unescape(e[2]):""}catch(t){return""}}},t.setLocalStorage=function(t,e){try{window.localStorage.setItem(t,e)}catch(r){var n=new Date;n.setTime(n.getTime()+2592e7);try{document.cookie=t+"="+escape(e)+";expires="+n.toUTCString()+";path=/;"}catch(t){}}},Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "chimee-helper-utils",
"version": "0.1.2",
"version": "0.1.3",
"description": "utils of chimee",

@@ -20,3 +20,4 @@ "main": "lib/index.js",

"b-umd": "rollup -c build/rollup.config.umd.js",
"b-min": "rollup -c build/rollup.config.min.js"
"b-min": "rollup -c build/rollup.config.min.js",
"doc": "documentation readme src/index.js --section=doc --github=true --project-version=true"
},

@@ -49,2 +50,3 @@ "repository": {

"babel-preset-latest": "^6.24.1",
"documentation": "^4.0.0-rc.1",
"eslint": "^4.0.0",

@@ -51,0 +53,0 @@ "eslint-plugin-flowtype": "^2.34.0",

@@ -1,2 +0,207 @@

# chimee-helper
# chimee-helper-utils
[![Build Status](https://img.shields.io/travis/Chimeejs/chimee-helper-utils/master.svg?style=flat-square)](https://travis-ci.org/Chimeejs/chimee-helper-utils.svg?branch=master)
[![Coverage Status](https://img.shields.io/coveralls/Chimeejs/chimee-helper-utils/master.svg?style=flat-square)](https://coveralls.io/github/Chimeejs/chimee-helper-utils?branch=master)
[![npm](https://img.shields.io/npm/v/chimee-helper-utils.svg?colorB=brightgreen&style=flat-square)](https://www.npmjs.com/package/chimee-helper-utils)
[![dependency Status](https://david-dm.org/Chimeejs/chimee-helper-utils.svg)](https://david-dm.org/Chimeejs/chimee-helper-utils)
[![devDependency Status](https://david-dm.org/Chimeejs/chimee-helper-utils/dev-status.svg)](https://david-dm.org/Chimeejs/chimee-helper-utils?type=dev)
utils of chimee
## get started
```shell
npm install chimee-helper-utils --save
```
if you are using `flow`, you should import our flow defination, by adding this to your `.flowconfig`.
```
[ignore]
[include]
[libs]
./node_modules/chimee-helper-utils/lib/index.flow.js
[options]
[lints]
```
## doc
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
### inBrowser
[src/index.js:8-10](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L8-L10 "Source code on GitHub")
check if the code running in browser environment (not include worker env)
Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
### makeArray
[src/index.js:16-18](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L16-L18 "Source code on GitHub")
转变一个类数组对象为数组
**Parameters**
- `obj` **any**
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>**
### transObjectAttrIntoArray
[src/index.js:27-33](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L27-L33 "Source code on GitHub")
sort Object attributes by function
and transfer them into array
**Parameters**
- `obj` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object form from numric
- `fn` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** sort function (optional, default `(a,b)=>+a-+b`)
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the sorted attirbutes array
### runRejectableQueue
[src/index.js:39-56](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L39-L56 "Source code on GitHub")
run a queue one by one.If include function reject or return false it will stop
**Parameters**
- `queue` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the queue which we want to run one by one
- `args` **...any**
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** tell us whether a queue run finished
### runStoppableQueue
[src/index.js:62-74](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L62-L74 "Source code on GitHub")
run a queue one by one.If include function return false it will stop
**Parameters**
- `queue` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the queue which we want to run one by one
- `args` **...any**
Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** tell the user if the queue run finished
### setFrozenAttr
[src/index.js:82-91](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L82-L91 "Source code on GitHub")
set an attribute to an object which is frozen.
Means you can't remove it, iterate it or rewrite it.
**Parameters**
- `obj` **!primitive**
- `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `value` **Anything**
### setAttrGetterAndSetter
[src/index.js:100-120](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L100-L120 "Source code on GitHub")
set attr on an Object. We will bind getter and setter on it if you provide to us
**Parameters**
- `obj` **!primitive**
- `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `$2` **any** (optional, default `{}`)
- `$2.get`
- `$2.set`
- `prefix` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the origin data's prefix. We do not plan to save it by closure. (optional, default `'__'`)
- `get` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
- `set` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
### throttle
[src/index.js:232-280](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L232-L280 "Source code on GitHub")
函数节流(控制函数执行频率)
**Parameters**
- `func` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** 要节流控制的函数,必填
- `wait` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
- `options` **any**
- `cxt` **any**
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** wait 等待时长
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** options {
leading&lt;是否首次调用立即执行,否:则按wait设定等待到期后调用才执行>:false,
trailing&lt;是否在调用并未到期时启用定时器,以保证一定执行>:true
}
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** cxt 上下文对象
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
### addTransMethod
[src/index.js:323-336](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L323-L336 "Source code on GitHub")
给obj对象扩展上trans方法,用以实现methodName对应的属性方法包装为静态函数且保持上下文的功能
**Parameters**
- `obj` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** 目标对象
### appendCSS
[src/index.js:343-353](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L343-L353 "Source code on GitHub")
追加样式代码到head的style标签,不存在则创建
**Parameters**
- `cssText` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 样式文本
Returns **[HTMLElement](https://developer.mozilla.org/en-US/docs/Web/HTML/Element)**
### formatDate
[src/index.js:361-379](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L361-L379 "Source code on GitHub")
格式化日期对象为:年-月-日 时:分:秒.毫秒
**Parameters**
- `date` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** Date日期对象 (optional, default `new Date()`)
- `pattern` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 要输出的日期格式,默认:`yyyy-MM-dd hh:mm:ss.i` (optional, default `'yyyy-MM-dd hh:mm:ss.i'`)
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
### getLocalStorage
[src/index.js:386-397](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L386-L397 "Source code on GitHub")
读取本地存储的值(不支持localStorage则降级到cookie)
**Parameters**
- `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 目标数据key
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
### setLocalStorage
[src/index.js:404-415](https://github.com/Chimeejs/chimee-helper-utils/blob/7eff79e4cede1bda28a36e60ae0893583a493ba3/src/index.js#L404-L415 "Source code on GitHub")
将指定key对应值写入本地存储(不支持localStorage则降级到cookie)
**Parameters**
- `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `val` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**

@@ -34,15 +34,2 @@ // @flow

}
// ********************** class operation ***************************
// class MixinBuilder {
// constructor (superclass) {
// this.superclass = superclass || class {};
// }
// with (...mixins) {
// return mixins.reduce((c, mixin) => mixin(c), this.superclass);
// }
// }
// export const mix = (superclass) => {
// return new MixinBuilder(superclass);
// };
/**

@@ -66,3 +53,3 @@ * run a queue one by one.If include function reject or return false it will stop

.then(() => step(index + 1))
.catch(() => reject('stop'));
.catch(err => reject(err || 'stop'));
};

@@ -111,4 +98,4 @@ step(0);

* @param {string} key
* @param {Function} options.get
* @param {Function} options.set
* @param {Function} get
* @param {Function} set
* @param {String} prefix the origin data's prefix. We do not plan to save it by closure.

@@ -115,0 +102,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc