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

redux-state-branch

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-state-branch - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

typings/images.d.ts

30

config-overrides.js

@@ -9,3 +9,33 @@ const path = require('path');

// grab the "oneOf" rule
const rules = config.module.rules[1].oneOf;
// add a markdown loader
rules.unshift(
/**
* This loader allows you to render inline code blocks
*/
{
test: /\.md$/,
include: path.resolve('./src'),
use: [
{
loader: require.resolve('babel-loader'),
options: {
// @remove-on-eject-begin
babelrc: false,
presets: [require.resolve('babel-preset-react-app')],
// @remove-on-eject-end
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true
}
},
require.resolve('react-markdown-loader')
]
}
);
return config;
};

27

dist/index.d.ts

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

export declare const makeType: (prefix: string, suffix?: string | undefined) => string;
export declare const ensureArray: (items: any) => any[];
export declare type ItemT<T> = T & {

@@ -5,2 +7,3 @@ id: string;

export declare type ItemsT<T> = T | T[];
export declare type ID = string;
export interface IConstants {

@@ -27,3 +30,3 @@ CREATE: string;

constructor(name: string);
byId(state: IState, id: string): T | void;
byId(state: IState, id: ID): T | void;
all(state: IState): T[];

@@ -38,23 +41,21 @@ where(state: IState, condition: (item: ItemT<T>) => boolean): T[];

constructor(constants: IConstants);
replace(items: ItemsT<T>, suffix?: string): {
replace(items: ItemsT<T>, devToolsSuffix?: string): {
type: string;
items: ItemsT<T>;
items: any[];
};
delete(items: ItemsT<T> | string | string[], suffix?: string): {
delete(items: ItemsT<T> | ID | ID[], devToolsSuffix?: string): {
type: string;
items: (string | T)[] | {
id: string;
}[];
items: any[];
};
create(items?: ItemsT<T>, suffix?: string): {
create(items?: ItemsT<T>, devToolsSuffix?: string): {
type: string;
items: {};
items: any[];
};
update(items: ItemsT<T>, suffix?: string): {
update(items: ItemsT<T>, devToolsSuffix?: string): {
type: string;
items: ItemsT<T>;
items: any[];
};
setMeta(meta: {
[key: string]: any;
}, suffix?: string): {
}, devToolsSuffix?: string): {
type: string;

@@ -65,3 +66,3 @@ meta: {

};
reset(suffix?: string): {
reset(devToolsSuffix?: string): {
type: string;

@@ -68,0 +69,0 @@ };

@@ -21,3 +21,8 @@ var __assign = (this && this.__assign) || function () {

};
import { makeType } from './utils';
export var makeType = function (prefix, suffix) {
return "" + prefix + (suffix ? "/" + suffix : "");
};
export var ensureArray = function (items) {
return Array.isArray(items) ? items : [items];
};
var Selectors = /** @class */ (function () {

@@ -47,38 +52,38 @@ function Selectors(name) {

}
Actions.prototype.replace = function (items, suffix) {
Actions.prototype.replace = function (items, devToolsSuffix) {
return {
type: makeType(this.constants.REPLACE, suffix),
items: items
type: makeType(this.constants.REPLACE, devToolsSuffix),
items: ensureArray(items)
};
};
Actions.prototype.delete = function (items, suffix) {
Actions.prototype.delete = function (items, devToolsSuffix) {
var wrappedItems = !Array.isArray(items) ? [items] : items;
return {
type: makeType(this.constants.DELETE, suffix),
items: typeof wrappedItems[0] === "string"
type: makeType(this.constants.DELETE, devToolsSuffix),
items: ensureArray(typeof wrappedItems[0] === "string"
? wrappedItems.map(function (id) { return ({ id: id }); })
: wrappedItems
: wrappedItems)
};
};
Actions.prototype.create = function (items, suffix) {
Actions.prototype.create = function (items, devToolsSuffix) {
return {
type: makeType(this.constants.CREATE, suffix),
items: items || {}
type: makeType(this.constants.CREATE, devToolsSuffix),
items: ensureArray(items || {})
};
};
Actions.prototype.update = function (items, suffix) {
Actions.prototype.update = function (items, devToolsSuffix) {
return {
type: makeType(this.constants.UPDATE, suffix),
items: items
type: makeType(this.constants.UPDATE, devToolsSuffix),
items: ensureArray(items)
};
};
Actions.prototype.setMeta = function (meta, suffix) {
Actions.prototype.setMeta = function (meta, devToolsSuffix) {
return {
type: makeType(this.constants.SET_META, suffix),
type: makeType(this.constants.SET_META, devToolsSuffix),
meta: meta
};
};
Actions.prototype.reset = function (suffix) {
Actions.prototype.reset = function (devToolsSuffix) {
return {
type: makeType(this.constants.RESET, suffix)
type: makeType(this.constants.RESET, devToolsSuffix)
};

@@ -111,3 +116,3 @@ };

if (state === void 0) { state = this.defaultState; }
var items = Array.isArray(action.items) ? action.items : [action.items];
var items = ensureArray(action.items);
var type = action.type.split("/", 2).join("/");

@@ -114,0 +119,0 @@ switch (type) {

// @flow
declare module 'redux-state-branch' {
declare type ItemsT<T> = T | T[];
declare type ItemT<T> = T & {
id: string
};
declare type ItemsT<T> = T | T[];
declare type ItemsLike<T> = $Shape<T> | $Shape<T>[];
declare export interface IConstants {

@@ -42,33 +42,33 @@ CREATE: string;

replace(
items: $Shape<T> | $Shape<T>[],
items: ItemsLikeT<T>,
suffix?: string
): {
type: string,
items: $Shape<T> | $Shape<T>[]
};
type: string,
items: ItemsLikeT<T>
};
delete(
items: $Shape<T> | $Shape<T>[] | string | string[],
items: ItemsLikeT<T> | string | string[],
suffix?: string
): {
type: string,
items:
type: string,
items:
| (string | T)[]
| {
id: string
}[]
};
id: string
}[]
};
create(
items?: $Shape<T> | $Shape<T>[],
items?: ItemsLikeT<T>,
suffix?: string
): {
type: string,
items: $Shape<T> | $Shape<T>[]
};
type: string,
items: ItemsLikeT<T>
};
update(
items: $Shape<T> | $Shape<T>[],
items: ItemsLikeT<T>,
suffix?: string
): {
type: string,
items: $Shape<T> | $Shape<T>[]
};
type: string,
items: ItemsLikeT<T>
};
setMeta(

@@ -80,12 +80,12 @@ meta: {

): {
type: string,
meta: {
[key: string]: any
}
};
type: string,
meta: {
[key: string]: any
}
};
reset(
suffix?: string
): {
type: string
};
type: string
};
}

@@ -92,0 +92,0 @@ declare interface IStateBranchOpts<T, A, S> {

{
"name": "redux-state-branch",
"version": "0.0.2",
"version": "0.0.3",
"private": false,
"description": "A redux wrapper for sane people.",
"homepage": "https://jamesmfriedman.github.io/redux-state-branch/",
"main": "dist/index",

@@ -22,13 +25,20 @@ "peerDependencies": {

"@types/react-redux": "^6.0.6",
"@types/react-router-dom": "^4.3.0",
"@types/react-test-renderer": "^16.0.2",
"@types/redux": "^3.6.0",
"@types/redux-thunk": "^2.1.0",
"flowgen": "^1.2.2",
"normalize.css": "^8.0.0",
"prettier-tslint": "^0.4.0",
"prismjs": "^1.15.0",
"react": "^16.4.2",
"react-app-rewired": "^1.5.2",
"typescript": "^3.0.1",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-markdown-loader": "git+https://github.com/jamesmfriedman/react-markdown-loader.git",
"react-redux": "^5.0.7",
"react-scripts-ts": "2.17.0"
"react-router-dom": "^4.3.1",
"react-scripts-ts": "2.17.0",
"rmwc": "^1.9.2",
"typescript": "^3.0.1"
}
}
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"baseUrl": ".",

@@ -16,3 +18,3 @@ "outDir": "out",

"noImplicitThis": true,
"noImplicitAny": true,
"noImplicitAny": false,
"strictNullChecks": true,

@@ -25,17 +27,3 @@ "suppressImplicitAnyIndexErrors": true,

},
"exclude": [
"node_modules",
"build",
"out",
"docs",
"scripts",
"acceptance-tests",
"webpack",
"jest",
"config-overrides.js",
"src/setupTests.ts",
"src/docs",
"src/index.tsx",
"flow-typed"
]
"include": ["src/**/*", "typings/**/*"]
}

@@ -6,3 +6,3 @@ {

"config/**/*.js",
"node_modules/**/*.ts",
"node_modules/**/*",
"coverage/lcov-report/*.js"

@@ -15,3 +15,6 @@ ]

"object-literal-sort-keys": false,
"no-console": false
"no-console": false,
"member-access": [true, "no-public"],
"jsx-boolean-value": false,
"jsx-no-lambda": false
},

@@ -18,0 +21,0 @@ "jsRules": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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