@cafebazaar/async-actions
Advanced tools
| function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(t,e,r){var n,i=void 0===e?{}:e,o=i.initialData,a=void 0===o?null:o,u=i.debounce,c=void 0===u?0:u,l=i.immediate,s=void 0!==l&&l,f=i.ctx,d=void 0===f?null:f;if(c&&(!("number"==typeof(n=c)&&!Number.isNaN(n)||n instanceof Number)||c<0))throw new Error("debounce option must be a positive number");var p=r({state:"notInitiated",data:a,error:null}),v=function(){return p.state="pending",p.error=null,p.data=null,Promise.resolve(t.apply(d||this,[].slice.call(arguments))).then(function(t){return p.state="fulfilled",p.data=t,t}).catch(function(t){throw p.state="rejected",p.error=t,t})};return c&&(v=function(t,e){var r;return function(){r&&clearTimeout(r),r=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),e)}}(v,c)),Object.defineProperties(v,{state:{get:function(){return p.state}},error:{get:function(){return p.error}},data:{get:function(){return p.data}}}),s&&v.call(this),v}function r(r,n){return function(i,o){return e(i,t({},r,o),n)}}export{e as asyncAction,r as asyncActionCreator}; |
+1
| function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function e(t,e,n){var r,o=void 0===e?{}:e,i=o.initialData,a=void 0===i?null:i,u=o.debounce,c=void 0===u?0:u,l=o.immediate,s=void 0!==l&&l,f=o.ctx,d=void 0===f?null:f;if(c&&(!("number"==typeof(r=c)&&!Number.isNaN(r)||r instanceof Number)||c<0))throw new Error("debounce option must be a positive number");var p=n({state:"notInitiated",data:a,error:null}),v=function(){return p.state="pending",p.error=null,p.data=null,Promise.resolve(t.apply(d||this,[].slice.call(arguments))).then(function(t){return p.state="fulfilled",p.data=t,t}).catch(function(t){throw p.state="rejected",p.error=t,t})};return c&&(v=function(t,e){var n;return function(){n&&clearTimeout(n),n=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),e)}}(v,c)),Object.defineProperties(v,{state:{get:function(){return p.state}},error:{get:function(){return p.error}},data:{get:function(){return p.data}}}),s&&v.call(this),v}exports.asyncAction=e,exports.asyncActionCreator=function(n,r){return function(o,i){return e(o,t({},n,i),r)}}; |
| function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(t,{initialData:e=null,debounce:r=0,immediate:n=!1,ctx:a=null}={},o){if(r&&(!("number"==typeof(i=r)&&!Number.isNaN(i)||i instanceof Number)||r<0))throw new Error("debounce option must be a positive number");var i;const u=o({state:"notInitiated",data:e,error:null});let l=function(...e){return u.state="pending",u.error=null,u.data=null,Promise.resolve(t.apply(a||this,e)).then(t=>(u.state="fulfilled",u.data=t,t)).catch(t=>{throw u.state="rejected",u.error=t,t})};return r&&(l=function(t,e){let r;return function(...n){r&&clearTimeout(r),r=setTimeout(t.bind(this,...n),e)}}(l,r)),Object.defineProperties(l,{state:{get:()=>u.state},error:{get:()=>u.error},data:{get:()=>u.data}}),n&&l.call(this),l}function r(r,n){return(a,o)=>e(a,t({},r,o),n)}export{e as asyncAction,r as asyncActionCreator}; |
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self)["async-actions"]={})}(this,function(t){function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function n(t,e,n){var r,o=void 0===e?{}:e,i=o.initialData,a=void 0===i?null:i,u=o.debounce,c=void 0===u?0:u,f=o.immediate,l=void 0!==f&&f,s=o.ctx,d=void 0===s?null:s;if(c&&(!("number"==typeof(r=c)&&!Number.isNaN(r)||r instanceof Number)||c<0))throw new Error("debounce option must be a positive number");var p=n({state:"notInitiated",data:a,error:null}),v=function(){return p.state="pending",p.error=null,p.data=null,Promise.resolve(t.apply(d||this,[].slice.call(arguments))).then(function(t){return p.state="fulfilled",p.data=t,t}).catch(function(t){throw p.state="rejected",p.error=t,t})};return c&&(v=function(t,e){var n;return function(){n&&clearTimeout(n),n=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),e)}}(v,c)),Object.defineProperties(v,{state:{get:function(){return p.state}},error:{get:function(){return p.error}},data:{get:function(){return p.data}}}),l&&v.call(this),v}t.asyncAction=n,t.asyncActionCreator=function(t,r){return function(o,i){return n(o,e({},t,i),r)}}}); |
| import{writable as t}from"svelte/store";export default function(e,n){return function(e,n,r){var i,o=void 0===n?{}:n,u=o.initialData,a=void 0===u?null:u,c=o.debounce,l=void 0===c?0:c,f=o.immediate,s=void 0!==f&&f,d=o.ctx,p=void 0===d?null:d;if(l&&(!("number"==typeof(i=l)&&!Number.isNaN(i)||i instanceof Number)||l<0))throw new Error("debounce option must be a positive number");var v=function(e){var n={};return Object.keys(e).forEach(function(r){var i=t(e[r]);Object.defineProperty(n,r,{get:function(){return i},set:function(t){i.update(function(){return t})}})}),n}({state:"notInitiated",data:a,error:null}),m=function(){return v.state="pending",v.error=null,v.data=null,Promise.resolve(e.apply(p||this,[].slice.call(arguments))).then(function(t){return v.state="fulfilled",v.data=t,t}).catch(function(t){throw v.state="rejected",v.error=t,t})};return l&&(m=function(t,e){var n;return function(){n&&clearTimeout(n),n=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),e)}}(m,l)),Object.defineProperties(m,{state:{get:function(){return v.state}},error:{get:function(){return v.error}},data:{get:function(){return v.data}}}),s&&m.call(this),m}(e,n)} |
| var t=require("svelte/store");module.exports=function(e,r){return function(e,r,n){var i,o=void 0===r?{}:r,u=o.initialData,a=void 0===u?null:u,c=o.debounce,l=void 0===c?0:c,s=o.immediate,f=void 0!==s&&s,d=o.ctx,v=void 0===d?null:d;if(l&&(!("number"==typeof(i=l)&&!Number.isNaN(i)||i instanceof Number)||l<0))throw new Error("debounce option must be a positive number");var b=function(e){var r={};return Object.keys(e).forEach(function(n){var i=t.writable(e[n]);Object.defineProperty(r,n,{get:function(){return i},set:function(t){i.update(function(){return t})}})}),r}({state:"notInitiated",data:a,error:null}),p=function(){return b.state="pending",b.error=null,b.data=null,Promise.resolve(e.apply(v||this,[].slice.call(arguments))).then(function(t){return b.state="fulfilled",b.data=t,t}).catch(function(t){throw b.state="rejected",b.error=t,t})};return l&&(p=function(t,e){var r;return function(){r&&clearTimeout(r),r=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),e)}}(p,l)),Object.defineProperties(p,{state:{get:function(){return b.state}},error:{get:function(){return b.error}},data:{get:function(){return b.data}}}),f&&p.call(this),p}(e,r)}; |
| import{writable as t}from"svelte/store";export default function(e,r){return function(t,{initialData:e=null,debounce:r=0,immediate:n=!1,ctx:o=null}={},a){if(r&&(!("number"==typeof(i=r)&&!Number.isNaN(i)||i instanceof Number)||r<0))throw new Error("debounce option must be a positive number");var i;const u=a({state:"notInitiated",data:e,error:null});let s=function(...e){return u.state="pending",u.error=null,u.data=null,Promise.resolve(t.apply(o||this,e)).then(t=>(u.state="fulfilled",u.data=t,t)).catch(t=>{throw u.state="rejected",u.error=t,t})};return r&&(s=function(t,e){let r;return function(...n){r&&clearTimeout(r),r=setTimeout(t.bind(this,...n),e)}}(s,r)),Object.defineProperties(s,{state:{get:()=>u.state},error:{get:()=>u.error},data:{get:()=>u.data}}),n&&s.call(this),s}(e,r,e=>{const r={};return Object.keys(e).forEach(n=>{const o=t(e[n]);Object.defineProperty(r,n,{get:()=>o,set(t){o.update(()=>t)}})}),r})} |
| !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("svelte/store")):"function"==typeof define&&define.amd?define(["svelte/store"],t):(e=e||self)["async-actions"]=t(e.store)}(this,function(e){return function(t,n){return function(t,n,r){var o,i=void 0===n?{}:n,u=i.initialData,a=void 0===u?null:u,c=i.debounce,f=void 0===c?0:c,l=i.immediate,s=void 0!==l&&l,d=i.ctx,p=void 0===d?null:d;if(f&&(!("number"==typeof(o=f)&&!Number.isNaN(o)||o instanceof Number)||f<0))throw new Error("debounce option must be a positive number");var v=function(t){var n={};return Object.keys(t).forEach(function(r){var o=e.writable(t[r]);Object.defineProperty(n,r,{get:function(){return o},set:function(e){o.update(function(){return e})}})}),n}({state:"notInitiated",data:a,error:null}),b=function(){return v.state="pending",v.error=null,v.data=null,Promise.resolve(t.apply(p||this,[].slice.call(arguments))).then(function(e){return v.state="fulfilled",v.data=e,e}).catch(function(e){throw v.state="rejected",v.error=e,e})};return f&&(b=function(e,t){var n;return function(){n&&clearTimeout(n),n=setTimeout(e.bind.apply(e,[this].concat([].slice.call(arguments))),t)}}(b,f)),Object.defineProperties(b,{state:{get:function(){return v.state}},error:{get:function(){return v.error}},data:{get:function(){return v.data}}}),s&&b.call(this),b}(t,n)}}); |
| import t from"vue";function n(){return(n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function e(t){return t&&"[object Function]"==={}.toString.call(t)}function r(n,e){return function(t,n,e){var r,o=void 0===n?{}:n,i=o.initialData,a=void 0===i?null:i,c=o.debounce,u=void 0===c?0:c,l=o.immediate,s=void 0!==l&&l,f=o.ctx,d=void 0===f?null:f;if(u&&(!("number"==typeof(r=u)&&!Number.isNaN(r)||r instanceof Number)||u<0))throw new Error("debounce option must be a positive number");var p=e({state:"notInitiated",data:a,error:null}),v=function(){return p.state="pending",p.error=null,p.data=null,Promise.resolve(t.apply(d||this,[].slice.call(arguments))).then(function(t){return p.state="fulfilled",p.data=t,t}).catch(function(t){throw p.state="rejected",p.error=t,t})};return u&&(v=function(t,n){var e;return function(){e&&clearTimeout(e),e=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),n)}}(v,u)),Object.defineProperties(v,{state:{get:function(){return p.state}},error:{get:function(){return p.error}},data:{get:function(){return p.data}}}),s&&v.call(this),v}(n,e,t.observable)}var o={install:function(t){t.mixin({beforeCreate:function(){var t=this;this.$options.asyncActions&&Object.keys(this.$options.asyncActions).forEach(function(o){var i=t.$options.asyncActions[o];if(e(i))t[o]=r(i,{ctx:t});else{var a=i.handler,c=function(t,n){if(null==t)return{};var e,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n.indexOf(e=i[r])>=0||(o[e]=t[e]);return o}(i,["handler"]);if(!e(a))throw new Error("handler must be a function");t[o]=r(a,n({ctx:t},c))}})}})}};export default o;export{r as asyncAction}; |
+1
| var t,n=(t=require("vue"))&&"object"==typeof t&&"default"in t?t.default:t;function e(){return(e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function r(t){return t&&"[object Function]"==={}.toString.call(t)}function i(t,e){return function(t,n,e){var r,i=void 0===n?{}:n,o=i.initialData,a=void 0===o?null:o,c=i.debounce,u=void 0===c?0:c,l=i.immediate,s=void 0!==l&&l,f=i.ctx,d=void 0===f?null:f;if(u&&(!("number"==typeof(r=u)&&!Number.isNaN(r)||r instanceof Number)||u<0))throw new Error("debounce option must be a positive number");var v=e({state:"notInitiated",data:a,error:null}),p=function(){return v.state="pending",v.error=null,v.data=null,Promise.resolve(t.apply(d||this,[].slice.call(arguments))).then(function(t){return v.state="fulfilled",v.data=t,t}).catch(function(t){throw v.state="rejected",v.error=t,t})};return u&&(p=function(t,n){var e;return function(){e&&clearTimeout(e),e=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),n)}}(p,u)),Object.defineProperties(p,{state:{get:function(){return v.state}},error:{get:function(){return v.error}},data:{get:function(){return v.data}}}),s&&p.call(this),p}(t,e,n.observable)}var o={install:function(t){t.mixin({beforeCreate:function(){var t=this;this.$options.asyncActions&&Object.keys(this.$options.asyncActions).forEach(function(n){var o=t.$options.asyncActions[n];if(r(o))t[n]=i(o,{ctx:t});else{var a=o.handler,c=function(t,n){if(null==t)return{};var e,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n.indexOf(e=o[r])>=0||(i[e]=t[e]);return i}(o,["handler"]);if(!r(a))throw new Error("handler must be a function");t[n]=i(a,e({ctx:t},c))}})}})}};exports.asyncAction=i,exports.default=o; |
| import t from"vue";function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function n(t){return t&&"[object Function]"==={}.toString.call(t)}function r(e,n){return function(t,{initialData:e=null,debounce:n=0,immediate:r=!1,ctx:o=null}={},i){if(n&&(!("number"==typeof(a=n)&&!Number.isNaN(a)||a instanceof Number)||n<0))throw new Error("debounce option must be a positive number");var a;const s=i({state:"notInitiated",data:e,error:null});let c=function(...e){return s.state="pending",s.error=null,s.data=null,Promise.resolve(t.apply(o||this,e)).then(t=>(s.state="fulfilled",s.data=t,t)).catch(t=>{throw s.state="rejected",s.error=t,t})};return n&&(c=function(t,e){let n;return function(...r){n&&clearTimeout(n),n=setTimeout(t.bind(this,...r),e)}}(c,n)),Object.defineProperties(c,{state:{get:()=>s.state},error:{get:()=>s.error},data:{get:()=>s.data}}),r&&c.call(this),c}(e,n,t.observable)}var o={install(t){t.mixin({beforeCreate(){this.$options.asyncActions&&Object.keys(this.$options.asyncActions).forEach(t=>{const o=this.$options.asyncActions[t];if(n(o))this[t]=r(o,{ctx:this});else{const{handler:i}=o,a=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(o[n]=t[n]);return o}(o,["handler"]);if(!n(i))throw new Error("handler must be a function");this[t]=r(i,e({ctx:this},a))}})}})}};export default o;export{r as asyncAction}; |
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e((t=t||self)["async-actions"]={},t.vue)}(this,function(t,e){function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function r(t){return t&&"[object Function]"==={}.toString.call(t)}function o(t,n){return function(t,e,n){var r,o=void 0===e?{}:e,i=o.initialData,a=void 0===i?null:i,c=o.debounce,u=void 0===c?0:c,s=o.immediate,l=void 0!==s&&s,f=o.ctx,d=void 0===f?null:f;if(u&&(!("number"==typeof(r=u)&&!Number.isNaN(r)||r instanceof Number)||u<0))throw new Error("debounce option must be a positive number");var p=n({state:"notInitiated",data:a,error:null}),v=function(){return p.state="pending",p.error=null,p.data=null,Promise.resolve(t.apply(d||this,[].slice.call(arguments))).then(function(t){return p.state="fulfilled",p.data=t,t}).catch(function(t){throw p.state="rejected",p.error=t,t})};return u&&(v=function(t,e){var n;return function(){n&&clearTimeout(n),n=setTimeout(t.bind.apply(t,[this].concat([].slice.call(arguments))),e)}}(v,u)),Object.defineProperties(v,{state:{get:function(){return p.state}},error:{get:function(){return p.error}},data:{get:function(){return p.data}}}),l&&v.call(this),v}(t,n,e.observable)}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var i={install:function(t){t.mixin({beforeCreate:function(){var t=this;this.$options.asyncActions&&Object.keys(this.$options.asyncActions).forEach(function(e){var i=t.$options.asyncActions[e];if(r(i))t[e]=o(i,{ctx:t});else{var a=i.handler,c=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(o[n]=t[n]);return o}(i,["handler"]);if(!r(a))throw new Error("handler must be a function");t[e]=o(a,n({ctx:t},c))}})}})}};t.asyncAction=o,t.default=i}); |
+1
-1
| { | ||
| "name": "@cafebazaar/async-actions", | ||
| "version": "0.4.2", | ||
| "version": "0.4.3", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "author": "Bazaar Front-End Chapter", |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
182862
9.97%26
85.71%235
40.72%14
600%