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

zeal-redux-utils

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zeal-redux-utils - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

lib/nullAction.js

20

CHANGELOG.md

@@ -5,4 +5,22 @@ # Change Log

## [Unreleased](https://github.com/CodingZeal/zeal-redux-utils/compare/v0.2.0...HEAD)
## [Unreleased](https://github.com/CodingZeal/zeal-redux-utils/compare/v0.3.0...HEAD)
## [0.3.0](https://github.com/CodingZeal/zeal-redux-utils/compare/v0.2.0...v0.3.0) - 2016-12-14
### Changed
* Check for flux standard actions (FSAs) in reducers created by `createReducer`. The check is performed only in development mode. Non-FSA actions raise a `NonStandardAction` exception. See [flux-standard-action](https://github.com/acdlite/flux-standard-action) for a definition of what is an FSA. ([#6](https://github.com/CodingZeal/zeal-redux-utils/pull/6))
### Added
* Add `nullAction` for use in reducer specs. A `nullAction` is a flux-standard-action-compliant action that shouldn't match any of your normal actions. It can be used to initialize the state in a reducer spec. e.g `const initialState = reducer(undefined, nullAction)` ([#7](https://github.com/CodingZeal/zeal-redux-utils/pull/7))
### Removed
* Cleaned non-essential files out of the npm package to reduce package size. ([#8](https://github.com/CodingZeal/zeal-redux-utils/pull/8))
### Internal
* Use [yarn](https://yarnpkg.com/) for all building and scripting tasks. ([#8](https://github.com/CodingZeal/zeal-redux-utils/pull/8))
## [0.2.0](https://github.com/CodingZeal/zeal-redux-utils/compare/v0.1.1...v0.2.0) - 2016-12-14

@@ -9,0 +27,0 @@

@@ -6,6 +6,34 @@ 'use strict';

});
exports.NonStandardAction = undefined;
exports.default = createReducer;
var _fluxStandardAction = require('flux-standard-action');
var _ramda = require('ramda');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var NonStandardAction = exports.NonStandardAction = function NonStandardAction(action) {
var _this = this;
_classCallCheck(this, NonStandardAction);
this.action = action;
this.message = 'attempting to handle an action that is not a flux-standard-action';
this.stack = new Error().stack;
this.toString = function () {
return _this.message + ': ' + JSON.stringify(_this.action);
};
};
var throwIfNotFSA = function throwIfNotFSA(action) {
if ((0, _fluxStandardAction.isFSA)(action)) return;
throw new NonStandardAction(action);
};
// eslint-disable-next-line no-process-env
var isProduction = process.env.NODE_ENV === 'production';
var ensureIsFSA = isProduction ? _ramda.identity : throwIfNotFSA;
function createReducer(initialState, handlers) {

@@ -15,4 +43,7 @@ return function () {

var action = arguments[1];
ensureIsFSA(action);
return (0, _ramda.propOr)(_ramda.identity, action.type, handlers)(state, action);
};
}

9

lib/index.js

@@ -6,3 +6,3 @@ 'use strict';

});
exports.globalizeSelectors = exports.createReducer = exports.createActionTypes = undefined;
exports.nullAction = exports.globalizeSelectors = exports.createReducer = exports.createActionTypes = undefined;

@@ -21,2 +21,6 @@ var _createActionTypes2 = require('./createActionTypes');

var _nullAction2 = require('./nullAction');
var _nullAction3 = _interopRequireDefault(_nullAction2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -26,2 +30,3 @@

exports.createReducer = _createReducer3.default;
exports.globalizeSelectors = _globalizeSelectors3.default;
exports.globalizeSelectors = _globalizeSelectors3.default;
exports.nullAction = _nullAction3.default;
{
"name": "zeal-redux-utils",
"version": "0.2.0",
"version": "0.3.0",
"description": "Utility functions for working with Redux",

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

"clean": "rimraf lib",
"prepublish": "npm test && npm run clean && npm run build",
"prepublish": "yarn test && yarn run clean && yarn build",
"test": "jest",
"test:watch": "npm run test -- --watch"
"test:watch": "yarn test -- --watch"
},

@@ -29,2 +29,3 @@ "repository": {

"dependencies": {
"flux-standard-action": "^1.0.0",
"ramda": "^0.22.1"

@@ -31,0 +32,0 @@ },

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