🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@wordpress/redux-routine

Package Overview
Dependencies
Maintainers
25
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/redux-routine - npm Package Compare versions

Comparing version

to
4.40.0

3

build-module/index.js

@@ -6,2 +6,3 @@ /**

import createRuntime from './runtime';
/**

@@ -19,3 +20,2 @@ * Creates a Redux middleware, given an object of controls where each key is an

*/
export default function createMiddleware(controls = {}) {

@@ -28,3 +28,2 @@ return store => {

}
return runtime(action);

@@ -31,0 +30,0 @@ };

@@ -5,4 +5,4 @@ /**

import { isPlainObject } from 'is-plain-object';
/* eslint-disable jsdoc/valid-types */
/**

@@ -15,6 +15,6 @@ * Returns true if the given object quacks like an action.

*/
export function isAction(object) {
return isPlainObject(object) && typeof object.type === 'string';
}
/**

@@ -29,3 +29,2 @@ * Returns true if the given object quacks like an action and has a specific

*/
export function isActionOfType(object, expectedType) {

@@ -32,0 +31,0 @@ /* eslint-enable jsdoc/valid-types */

/* eslint-disable jsdoc/valid-types */
/**

@@ -4,0 +3,0 @@ * Returns true if the given object is a generator, or false otherwise.

/**
* External dependencies
*/
import { create } from 'rungen';
import isPromise from 'is-promise';
/**

@@ -11,2 +11,3 @@ * Internal dependencies

import { isActionOfType, isAction } from './is-action';
/**

@@ -18,3 +19,2 @@ * Create a co-routine runtime.

*/
export default function createRuntime(controls = {}, dispatch) {

@@ -25,5 +25,3 @@ const rungenControls = Object.entries(controls).map(([actionType, control]) => (value, next, iterate, yieldNext, yieldError) => {

}
const routine = control(value);
if (isPromise(routine)) {

@@ -35,6 +33,4 @@ // Async control routine awaits resolution.

}
return true;
});
const unhandledActionControl = (value, next) => {

@@ -44,3 +40,2 @@ if (!isAction(value)) {

}
dispatch(value);

@@ -50,3 +45,2 @@ next();

};
rungenControls.push(unhandledActionControl);

@@ -58,3 +52,2 @@ const rungenRuntime = create(rungenControls);

}
resolve(result);

@@ -61,0 +54,0 @@ }, reject));

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,7 +8,4 @@ value: true

exports.default = createMiddleware;
var _isGenerator = _interopRequireDefault(require("./is-generator"));
var _runtime = _interopRequireDefault(require("./runtime"));
/**

@@ -38,3 +34,2 @@ * Internal dependencies

}
return runtime(action);

@@ -41,0 +36,0 @@ };

@@ -8,5 +8,3 @@ "use strict";

exports.isActionOfType = isActionOfType;
var _isPlainObject = require("is-plain-object");
/**

@@ -17,3 +15,2 @@ * External dependencies

/* eslint-disable jsdoc/valid-types */
/**

@@ -29,2 +26,3 @@ * Returns true if the given object quacks like an action.

}
/**

@@ -39,4 +37,2 @@ * Returns true if the given object quacks like an action and has a specific

*/
function isActionOfType(object, expectedType) {

@@ -43,0 +39,0 @@ /* eslint-enable jsdoc/valid-types */

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

exports.default = isGenerator;
/* eslint-disable jsdoc/valid-types */
/**

@@ -12,0 +10,0 @@ * Returns true if the given object is a generator, or false otherwise.

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,9 +8,5 @@ value: true

exports.default = createRuntime;
var _rungen = require("rungen");
var _isPromise = _interopRequireDefault(require("is-promise"));
var _isAction = require("./is-action");
/**

@@ -36,5 +31,3 @@ * External dependencies

}
const routine = control(value);
if ((0, _isPromise.default)(routine)) {

@@ -46,6 +39,4 @@ // Async control routine awaits resolution.

}
return true;
});
const unhandledActionControl = (value, next) => {

@@ -55,3 +46,2 @@ if (!(0, _isAction.isAction)(value)) {

}
dispatch(value);

@@ -61,3 +51,2 @@ next();

};
rungenControls.push(unhandledActionControl);

@@ -69,3 +58,2 @@ const rungenRuntime = (0, _rungen.create)(rungenControls);

}
resolve(result);

@@ -72,0 +60,0 @@ }, reject));

@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 4.40.0 (2023-08-16)
## 4.39.0 (2023-08-10)

@@ -7,0 +9,0 @@

{
"name": "@wordpress/redux-routine",
"version": "4.39.0",
"version": "4.40.0",
"description": "Redux middleware for generator coroutines.",

@@ -43,3 +43,3 @@ "author": "The WordPress Contributors",

},
"gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
"gitHead": "78a288d55b83a713b2f7d98d5a855c0771a2afc6"
}
/**
* External dependencies
*/
import { create, Control } from 'rungen';
import type { Control } from 'rungen';
import { create } from 'rungen';
import isPromise from 'is-promise';

@@ -6,0 +7,0 @@ import type { Dispatch, AnyAction } from 'redux';

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

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

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