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

redux-ease

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-ease - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

jest.config.js

40

dist/ActionCreatorBuilder.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ActionCreatorBuilder = /** @class */ (function () {
function ActionCreatorBuilder(reducerCode, reducerJoinSymbol) {
if (reducerCode === void 0) { reducerCode = ''; }
if (reducerJoinSymbol === void 0) { reducerJoinSymbol = '_'; }
class ActionCreatorBuilder {
constructor(reducerCode = '', reducerJoinSymbol = '_') {
this.actionTypePrefix = (reducerCode) ? reducerCode + reducerJoinSymbol : '';
}
ActionCreatorBuilder.prototype.getConst = function (actionTypeCode) {
getConst(actionTypeCode) {
return this.actionTypePrefix + actionTypeCode;
};
ActionCreatorBuilder.prototype.getConstants = function (actionTypeCodes) {
var _this = this;
var result = {};
actionTypeCodes.forEach(function (actionTypeCode) {
result[actionTypeCode] = _this.actionTypePrefix + actionTypeCode;
}
getConstants(actionTypeCodes) {
const result = {};
actionTypeCodes.forEach((actionTypeCode) => {
result[actionTypeCode] = this.actionTypePrefix + actionTypeCode;
});
return result;
};
ActionCreatorBuilder.prototype.build = function (actionTypeCode, creator) {
var typeCode = this.getConst(actionTypeCode);
function actionCreator() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
}
build(actionTypeCode, creator) {
const typeCode = this.getConst(actionTypeCode);
function actionCreator(...args) {
return {

@@ -34,8 +27,7 @@ type: typeCode,

return actionCreator;
};
ActionCreatorBuilder.prototype.buildDynamic = function (creator) {
}
buildDynamic(creator) {
return creator;
};
return ActionCreatorBuilder;
}());
}
}
exports.ActionCreatorBuilder = ActionCreatorBuilder;

9

dist/getters.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ActionCreatorBuilder_1 = require("./ActionCreatorBuilder");
var ReducerBuilder_1 = require("./ReducerBuilder");
exports.getActionCreator = function (reducerCode, joinSymbol) {
if (joinSymbol === void 0) { joinSymbol = '_'; }
const ActionCreatorBuilder_1 = require("./ActionCreatorBuilder");
const ReducerBuilder_1 = require("./ReducerBuilder");
exports.getActionCreator = (reducerCode, joinSymbol = '_') => {
return new ActionCreatorBuilder_1.ActionCreatorBuilder(reducerCode, joinSymbol);
};
exports.getReducerBuilder = function (defaultState) {
exports.getReducerBuilder = (defaultState) => {
return new ReducerBuilder_1.ReducerBuilder(defaultState);
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ReducerBuilder = /** @class */ (function () {
function ReducerBuilder(defaultState) {
class ReducerBuilder {
constructor(defaultState) {
this.defaultState = defaultState;

@@ -9,12 +9,11 @@ this.handlers = new Map();

}
ReducerBuilder.prototype.setDefaultState = function (state) {
setDefaultState(state) {
this.defaultState = state;
return this;
};
ReducerBuilder.prototype.copyState = function () {
}
copyState() {
this.toCopyState = true;
return this;
};
ReducerBuilder.prototype.handle = function (actionCreators, handler) {
var _this = this;
}
handle(actionCreators, handler) {
if (typeof handler !== 'function') {

@@ -24,3 +23,3 @@ throw TypeError('Reducer Action Handler should be a function!');

if (Array.isArray(actionCreators)) {
actionCreators.forEach(function (actionCreator) { _this.handlers.set(actionCreator.typeCode, handler); });
actionCreators.forEach((actionCreator) => { this.handlers.set(actionCreator.typeCode, handler); });
}

@@ -31,5 +30,4 @@ else {

return this;
};
ReducerBuilder.prototype.handleType = function (actionTypes, handler) {
var _this = this;
}
handleType(actionTypes, handler) {
if (typeof handler !== 'function') {

@@ -39,3 +37,3 @@ throw TypeError('Reducer Action Handler should be a function!');

if (Array.isArray(actionTypes)) {
actionTypes.forEach(function (actionType) { _this.handlers.set(actionType, handler); });
actionTypes.forEach((actionType) => { this.handlers.set(actionType, handler); });
}

@@ -46,16 +44,15 @@ else {

return this;
};
ReducerBuilder.prototype.build = function () {
var _this = this;
return function (state, action) {
state = state || _this.defaultState;
}
build() {
return (state, action) => {
state = state || this.defaultState;
if (!action) {
return state;
}
if (_this.handlers.has(action.type)) {
if (_this.toCopyState) {
return Object.assign({}, state, Reflect.apply(_this.handlers.get(action.type), undefined, [state, action]));
if (this.handlers.has(action.type)) {
if (this.toCopyState) {
return Object.assign({}, state, Reflect.apply(this.handlers.get(action.type), undefined, [state, action]));
}
else {
return Reflect.apply(_this.handlers.get(action.type), undefined, [state, action]);
return Reflect.apply(this.handlers.get(action.type), undefined, [state, action]);
}

@@ -67,5 +64,4 @@ }

};
};
return ReducerBuilder;
}());
}
}
exports.ReducerBuilder = ReducerBuilder;
{
"name": "redux-ease",
"version": "0.5.1",
"version": "0.5.2",
"description": "Reduce Redux boilerplate with ease",

@@ -10,5 +10,12 @@ "main": "dist/index.js",

"repository": "queses/redux-ease",
"scripts": {
"build": "tsc",
"test": "jest"
},
"devDependencies": {
"@types/jest": "^24.0.12",
"jest": "^24.8.0",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5"
}
}

@@ -5,2 +5,14 @@ # Redux Ease 👌

## Installation
```
yarn add redux-ease
```
or...
```
npm i redux-ease
```
## Usage example

@@ -7,0 +19,0 @@

{
"compilerOptions": {
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "es2016", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */

@@ -10,3 +10,3 @@ "declaration": true, /* Generates corresponding '.d.ts' file. */

},
"include": [ "src" ]
"include": [ "src", "types" ]
}

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

import { Reducer } from "redux";
export interface TActionCreator <A = any, P = any> {

@@ -4,0 +2,0 @@ (actionTypeCode: string, creator: (...args: A[]) => P): TExportedActionCreator<A, P>

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