Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-awaiter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-awaiter - npm Package Compare versions

Comparing version 0.2.4 to 0.3.0

9

dist/redux-awaiter.js

@@ -40,5 +40,7 @@ (function (global, factory) {

this.awaiters = this.awaiters.concat([awaiter]);
return this.awaiters.length;
};
Awaiters.prototype.consume = function (action) {
this.awaiters = this.awaiters.filter(Awaiters.consumer(action));
return this.awaiters.length;
};

@@ -56,3 +58,8 @@ Awaiters.instance = new Awaiters();

var take = function (pattern) {
return new Promise(function (resolve) { return awaiters.produce({ pattern: pattern, resolve: resolve }); });
return new Promise(function (resolve, reject) {
if (typeof pattern !== 'string' && !(pattern instanceof RegExp) && typeof pattern !== 'function') {
return reject(new TypeError('take(...): Invalid pattern. Expected string, RegExp or function.'));
}
awaiters.produce({ pattern: pattern, resolve: resolve });
});
};

@@ -59,0 +66,0 @@

2

dist/redux-awaiter.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxAwaiter={})}(this,function(e){"use strict";var t=function(){function e(){this.awaiters=[]}return Object.defineProperty(e,"Instance",{get:function(){return this.instance},enumerable:!0,configurable:!0}),e.consumer=function(e){return function(t){var n=t.pattern,r=t.resolve,i=function(e,t){var n=e.type;return"string"==typeof t?n===t:t instanceof RegExp?t.test(n):"function"==typeof t&&t(e)}(e,n);return i&&r(e),!i}},e.prototype.produce=function(e){this.awaiters=this.awaiters.concat([e])},e.prototype.consume=function(t){this.awaiters=this.awaiters.filter(e.consumer(t))},e.instance=new e,e}().Instance,n=function(e){return new Promise(function(n){return t.produce({pattern:e,resolve:n})})};e.createAwaiterMiddleware=function(){return function(){return function(e){return function(n){return t.consume(n),e(n)}}}},e.take=n,e.takeAllOf=function(e){return Promise.all(e.map(n))},e.takeOneOf=function(e){return Promise.race(e.map(n))},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.ReduxAwaiter={})}(this,function(e){"use strict";var t=function(){function e(){this.awaiters=[]}return Object.defineProperty(e,"Instance",{get:function(){return this.instance},enumerable:!0,configurable:!0}),e.consumer=function(e){return function(t){var n=t.pattern,r=t.resolve,i=function(e,t){var n=e.type;return"string"==typeof t?n===t:t instanceof RegExp?t.test(n):"function"==typeof t&&t(e)}(e,n);return i&&r(e),!i}},e.prototype.produce=function(e){return this.awaiters=this.awaiters.concat([e]),this.awaiters.length},e.prototype.consume=function(t){return this.awaiters=this.awaiters.filter(e.consumer(t)),this.awaiters.length},e.instance=new e,e}().Instance,n=function(e){return new Promise(function(n,r){if("string"!=typeof e&&!(e instanceof RegExp)&&"function"!=typeof e)return r(new TypeError("take(...): Invalid pattern. Expected string, RegExp or function."));t.produce({pattern:e,resolve:n})})};e.createAwaiterMiddleware=function(){return function(){return function(e){return function(n){return t.consume(n),e(n)}}}},e.take=n,e.takeAllOf=function(e){return Promise.all(e.map(n))},e.takeOneOf=function(e){return Promise.race(e.map(n))},Object.defineProperty(e,"__esModule",{value:!0})});

@@ -8,6 +8,6 @@ import { Action, Awaiter } from '../types';

private constructor();
produce<P = {}, M = {}>(awaiter: Awaiter<P, M>): void;
consume<P = {}, M = {}>(action: Action<P, M>): void;
produce<P = {}, M = {}>(awaiter: Awaiter<P, M>): number;
consume<P = {}, M = {}>(action: Action<P, M>): number;
}
declare const awaiters: Awaiters;
export default awaiters;

@@ -34,5 +34,7 @@ var Awaiters = (function () {

this.awaiters = this.awaiters.concat([awaiter]);
return this.awaiters.length;
};
Awaiters.prototype.consume = function (action) {
this.awaiters = this.awaiters.filter(Awaiters.consumer(action));
return this.awaiters.length;
};

@@ -39,0 +41,0 @@ Awaiters.instance = new Awaiters();

import awaiters from '../internal/awaiters';
export var take = function (pattern) {
return new Promise(function (resolve) { return awaiters.produce({ pattern: pattern, resolve: resolve }); });
return new Promise(function (resolve, reject) {
if (typeof pattern !== 'string' && !(pattern instanceof RegExp) && typeof pattern !== 'function') {
return reject(new TypeError('take(...): Invalid pattern. Expected string, RegExp or function.'));
}
awaiters.produce({ pattern: pattern, resolve: resolve });
});
};
//# sourceMappingURL=take.js.map

@@ -36,5 +36,7 @@ "use strict";

this.awaiters = this.awaiters.concat([awaiter]);
return this.awaiters.length;
};
Awaiters.prototype.consume = function (action) {
this.awaiters = this.awaiters.filter(Awaiters.consumer(action));
return this.awaiters.length;
};

@@ -41,0 +43,0 @@ Awaiters.instance = new Awaiters();

@@ -5,4 +5,9 @@ "use strict";

exports.take = function (pattern) {
return new Promise(function (resolve) { return awaiters_1.default.produce({ pattern: pattern, resolve: resolve }); });
return new Promise(function (resolve, reject) {
if (typeof pattern !== 'string' && !(pattern instanceof RegExp) && typeof pattern !== 'function') {
return reject(new TypeError('take(...): Invalid pattern. Expected string, RegExp or function.'));
}
awaiters_1.default.produce({ pattern: pattern, resolve: resolve });
});
};
//# sourceMappingURL=take.js.map
{
"name": "redux-awaiter",
"version": "0.2.4",
"version": "0.3.0",
"description": "A Redux middleware for giving opportunities to await and receive actions in anywhere",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -36,2 +36,3 @@ import { Action, Pattern, Awaiter } from '../types';

this.awaiters = [...this.awaiters, awaiter];
return this.awaiters.length;
}

@@ -41,2 +42,3 @@

this.awaiters = this.awaiters.filter(Awaiters.consumer(action));
return this.awaiters.length;
}

@@ -43,0 +45,0 @@ }

@@ -5,2 +5,7 @@ import awaiters from '../internal/awaiters';

export const take = <P = {}, M = {}>(pattern: Pattern<P, M>) =>
new Promise<Action<P, M>>(resolve => awaiters.produce({ pattern, resolve }));
new Promise<Action<P, M>>((resolve, reject) => {
if (typeof pattern !== 'string' && !(pattern instanceof RegExp) && typeof pattern !== 'function') {
return reject(new TypeError('take(...): Invalid pattern. Expected string, RegExp or function.'));
}
awaiters.produce({ pattern, resolve });
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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