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

create-reducer-tree

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-reducer-tree - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

10

dist/create-reducer-tree.d.ts
export declare function createReducerTree(reducerTree: any): any;
export declare function fetchKeysInItem(item: any): Array<string>;
export declare function fetchActionsForTree(item: any, actionTypes?: Array<string>): Array<string>;
export declare function generateInitialState(tree: any): any;
export declare function createParentReducer(reducerTree: any): Function;
export declare function checkValidityBranch(reducerTree: any): void;
export declare function getDeepestLevels(reducerTree: any, deepestLevels?: any): Array<{
actions: Array<string>;
reducer: Function;
initialState: any;
}>;

@@ -16,3 +16,2 @@ "use strict";

}
exports.fetchKeysInItem = fetchKeysInItem;
function fetchActionsForTree(item, actionTypes) {

@@ -31,3 +30,2 @@ if (actionTypes === void 0) { actionTypes = []; }

}
exports.fetchActionsForTree = fetchActionsForTree;
function generateInitialState(tree) {

@@ -50,3 +48,2 @@ function handleStateChunk(state) {

}
exports.generateInitialState = generateInitialState;
function createParentReducer(reducerTree) {

@@ -74,3 +71,2 @@ var actions = fetchActionsForTree(reducerTree);

}
exports.createParentReducer = createParentReducer;
function checkValidityBranch(reducerTree) {

@@ -90,3 +86,2 @@ var deepestLevels = getDeepestLevels(reducerTree);

}
exports.checkValidityBranch = checkValidityBranch;
function getDeepestLevels(reducerTree, deepestLevels) {

@@ -108,3 +103,2 @@ if (deepestLevels === void 0) { deepestLevels = []; }

}
exports.getDeepestLevels = getDeepestLevels;
//# sourceMappingURL=create-reducer-tree.js.map

10

package.json
{
"name": "create-reducer-tree",
"version": "0.0.6",
"version": "0.0.7",
"description": "A tool to create a redux reducer composition tree",

@@ -8,6 +8,6 @@ "main": "dist/create-reducer-tree.js",

"scripts": {
"build": "tsc",
"prebuild": "rimraf dist && typings i",
"prepublish": "npm run test && npm run build",
"test": "karma start"
"test": "karma start --NODE_ENV=test",
"prebuild": "rm -rf dist",
"build": "node_modules/.bin/tsc",
"prepublish": "npm run build"
},

@@ -14,0 +14,0 @@ "keywords": [

@@ -15,7 +15,7 @@ declare function require(string: string): any;

export function fetchKeysInItem(item: any): Array<string> {
function fetchKeysInItem(item: any): Array<string> {
return (Array.isArray(item) || typeof item !== "object") ? [] : Object.keys(item);
}
export function fetchActionsForTree(item: any, actionTypes: Array<string> = []): Array<string> {
function fetchActionsForTree(item: any, actionTypes: Array<string> = []): Array<string> {
let keys: Array<string> = fetchKeysInItem(item);

@@ -32,3 +32,3 @@ keys.forEach((key: string) => {

}
export function generateInitialState(tree: any): any {
function generateInitialState(tree: any): any {
function handleStateChunk(state: any) {

@@ -51,6 +51,6 @@ let newState = {};

}
export function createParentReducer(reducerTree: any): Function {
function createParentReducer(reducerTree: any): Function {
let actions = fetchActionsForTree(reducerTree);
let keys = fetchKeysInItem(reducerTree);
let initialState = generateInitialState(reducerTree);
let initialState = generateInitialState(reducerTree);
return function (state: any = clone(initialState), action: {type: string, payload: any}) {

@@ -74,3 +74,3 @@ if (actions.indexOf(action.type) > -1) {

export function checkValidityBranch(reducerTree: any) {
function checkValidityBranch(reducerTree: any) {
let deepestLevels = getDeepestLevels(reducerTree);

@@ -90,3 +90,3 @@ deepestLevels.forEach((deepestLevel) => {

export function getDeepestLevels(reducerTree: any, deepestLevels: any = []): Array<{actions: Array<string>, reducer: Function, initialState: any}> {
function getDeepestLevels(reducerTree: any, deepestLevels: any = []): Array<{actions: Array<string>, reducer: Function, initialState: any}> {
let keys: Array<string> = fetchKeysInItem(reducerTree);

@@ -93,0 +93,0 @@ // if no keys except maybe "actions" or "reducer"

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