UNPKG

@wordpress/redux-routine

Version:
38 lines (35 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isAction = isAction; exports.isActionOfType = isActionOfType; var _isPlainObject = require("is-plain-object"); /** * External dependencies */ /* eslint-disable jsdoc/valid-types */ /** * Returns true if the given object quacks like an action. * * @param {any} object Object to test * * @return {object is import('redux').AnyAction} Whether object is an action. */ function isAction(object) { return (0, _isPlainObject.isPlainObject)(object) && typeof object.type === 'string'; } /** * Returns true if the given object quacks like an action and has a specific * action type * * @param {unknown} object Object to test * @param {string} expectedType The expected type for the action. * * @return {object is import('redux').AnyAction} Whether object is an action and is of specific type. */ function isActionOfType(object, expectedType) { /* eslint-enable jsdoc/valid-types */ return isAction(object) && object.type === expectedType; } //# sourceMappingURL=is-action.js.map