Socket
Socket
Sign inDemoInstall

redux-fluent

Package Overview
Dependencies
6
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.27.2 to 0.99.1

dist/.gitkeep

97

CHANGELOG.md

@@ -1,66 +0,83 @@

# Change Log
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="0.27.2"></a>
## [0.27.2](https://github.com/Code-Y/redux-fluent/compare/v0.27.1...v0.27.2) (2018-05-22)
### [0.99.1](https://github.com/Code-Y/redux-fluent/compare/v0.26.1...v0.99.1) (2019-12-24)
### Bug Fixes
<a name="0.27.1"></a>
## [0.27.1](https://github.com/Code-Y/redux-fluent/compare/v0.27.0...v0.27.1) (2018-05-22)
* **docs:** logo size and link ([292d504](https://github.com/Code-Y/redux-fluent/commit/292d5040531b8fe3aacbb9b0d4a4fe7fdde0890c))
### [0.26.1](https://github.com/Code-Y/redux-fluent/compare/v0.9.8...v0.26.1) (2019-12-20)
### Bug Fixes
* **Action:** redux isPlainObject doesn't accept bare objects ([#18](https://github.com/Code-Y/redux-fluent/issues/18)) ([5ad16c5](https://github.com/Code-Y/redux-fluent/commit/5ad16c5))
* export typescript definitions ([9373d20](https://github.com/Code-Y/redux-fluent/commit/9373d20))
<a name="0.27.0"></a>
# [0.27.0](https://github.com/Code-Y/redux-fluent/compare/v0.25.0...v0.27.0) (2018-03-23)
<a name="0.26.0"></a>
# [0.26.0](https://github.com/Code-Y/redux-fluent/compare/v0.25.5...v0.26.0) (2018-02-18)
### [0.9.5](https://github.com/Code-Y/redux-fluent/compare/v0.9.4...v0.9.5) (2019-06-20)
### Bug Fixes
* rfa implementation ([7bbd5a0](https://github.com/Code-Y/redux-fluent/commit/7bbd5a0))
# [0.9.0](https://github.com/Code-Y/redux-fluent/compare/v0.8.11...v0.9.0) (2019-03-23)
### Features
* **testing:** add patchReducerConfig ([#17](https://github.com/Code-Y/redux-fluent/issues/17)) ([3ed9002](https://github.com/Code-Y/redux-fluent/commit/3ed9002))
* **action:** add typesafe Error ([058955a](https://github.com/Code-Y/redux-fluent/commit/058955a)), closes [#33](https://github.com/Code-Y/redux-fluent/issues/33)
## [0.8.5](https://github.com/Code-Y/redux-fluent/compare/v0.8.4...v0.8.5) (2019-03-10)
<a name="0.25.5"></a>
## [0.25.5](https://github.com/Code-Y/redux-fluent/compare/v0.25.4...v0.25.5) (2018-02-16)
### Bug Fixes
* **webpack:** export Testing Utilities ([d8dfd66](https://github.com/Code-Y/redux-fluent/commit/d8dfd66))
* **typings:** add action.error field ([11aace0](https://github.com/Code-Y/redux-fluent/commit/11aace0))
### Reverts
<a name="0.25.4"></a>
## [0.25.4](https://github.com/Code-Y/redux-fluent/compare/v0.24.4...v0.25.4) (2018-02-16)
* don't include action.error if no payload ([523d069](https://github.com/Code-Y/redux-fluent/commit/523d069))
# [0.8.0](https://github.com/Code-Y/redux-fluent/compare/v0.6.2...v0.8.0) (2019-03-10)
### Features
* **Testing:** add createFakeStore(...reducers) ([#16](https://github.com/Code-Y/redux-fluent/issues/16)) ([55ccabf](https://github.com/Code-Y/redux-fluent/commit/55ccabf))
* **api:** export createCombinableReducers ([be77848](https://github.com/Code-Y/redux-fluent/commit/be77848))
<a name="0.26.1"></a>
## [0.26.1](https://github.com/Code-Y/redux-fluent/compare/v0.25.0...v0.26.1) (2018-03-23)
# [0.7.0](https://github.com/Code-Y/redux-fluent/compare/v0.6.2...v0.7.0) (2019-03-09)
### Features
<a name="0.25.0"></a>
# [0.25.0](https://github.com/Code-Y/redux-fluent/compare/v0.24.4...v0.25.0) (2018-03-23)
=======
* **api:** export createCombinableReducers ([be77848](https://github.com/Code-Y/redux-fluent/commit/be77848))
<a name="0.27.1"></a>
## [0.27.1](https://github.com/Code-Y/redux-fluent/compare/v0.27.0...v0.27.1) (2018-05-22)
### Bug Fixes
* **Action:** redux isPlainObject doesn't accept bare objects ([#18](https://github.com/Code-Y/redux-fluent/issues/18)) ([5ad16c5](https://github.com/Code-Y/redux-fluent/commit/5ad16c5))
<a name="0.26.0"></a>
# [0.26.0](https://github.com/Code-Y/redux-fluent/compare/v0.25.5...v0.26.0) (2018-02-18)
>>>>>>> e7a1b8beaf855f82560404c0e6aad7e9eac45931

@@ -70,30 +87,24 @@

<<<<<<< HEAD
* **e2e:** add redux, flux standard action integration tests ([#14](https://github.com/Code-Y/redux-fluent/issues/14)) ([efdf697](https://github.com/Code-Y/redux-fluent/commit/efdf697))
=======
* **testing:** add patchReducerConfig ([#17](https://github.com/Code-Y/redux-fluent/issues/17)) ([3ed9002](https://github.com/Code-Y/redux-fluent/commit/3ed9002))
>>>>>>> e7a1b8beaf855f82560404c0e6aad7e9eac45931
<a name="0.24.4"></a>
## [0.24.4](https://github.com/Code-Y/redux-fluent/compare/v0.24.3...v0.24.4) (2018-01-27)
<a name="0.25.5"></a>
## [0.25.5](https://github.com/Code-Y/redux-fluent/compare/v0.25.4...v0.25.5) (2018-02-16)
### Bug Fixes
<a name="0.24.3"></a>
## [0.24.3](https://github.com/Code-Y/redux-fluent/compare/v0.24.2...v0.24.3) (2018-01-26)
* **webpack:** export Testing Utilities ([d8dfd66](https://github.com/Code-Y/redux-fluent/commit/d8dfd66))
<a name="0.24.2"></a>
## [0.24.2](https://github.com/Code-Y/redux-fluent/compare/v0.24.1...v0.24.2) (2018-01-26)
<a name="0.25.4"></a>
## [0.25.4](https://github.com/Code-Y/redux-fluent/compare/v0.24.4...v0.25.4) (2018-02-16)
### Features
<a name="0.24.1"></a>
## [0.24.1](https://github.com/Code-Y/redux-fluent/compare/v0.24.0...v0.24.1) (2018-01-26)
* **Testing:** add createFakeStore(...reducers) ([#16](https://github.com/Code-Y/redux-fluent/issues/16)) ([55ccabf](https://github.com/Code-Y/redux-fluent/commit/55ccabf))
<a name="0.24.0"></a>

@@ -126,12 +137,2 @@ # [0.24.0](https://github.com/Code-Y/redux-fluent/compare/v0.22.2...v0.24.0) (2018-01-26)

<a name="0.22.2"></a>
## [0.22.2](https://github.com/Code-Y/redux-fluent/compare/v0.22.1...v0.22.2) (2018-01-24)
<a name="0.22.1"></a>
## [0.22.1](https://github.com/Code-Y/redux-fluent/compare/v0.22.0...v0.22.1) (2018-01-24)
<a name="0.22.0"></a>

@@ -138,0 +139,0 @@ # [0.22.0](https://github.com/Code-Y/redux-fluent/compare/v0.21.4...v0.22.0) (2018-01-24)

@@ -1,131 +0,2 @@

declare module 'redux-fluent' {
export function createReducer<
S extends object = {},
C extends object = object,
D extends string = string
>(domain: D): {
default: I.Default<D, S, C>;
case: I.Case<D, S, C>;
config<CC extends C>(config: CC): {
default: I.Default<D, S, CC>;
case: I.Case<D, S, CC>
}
};
export function createAction<
P extends object = object,
M extends object = object,
T extends string = string
>(type: T, payloadCreator?: (p: any) => P, metaCreator?: (m: any) => M): I.ActionCreator<P, M, T>;
export function createCombinableReducers<
R extends { domain: string }
>(...reducers: R[]): {
[domain: string]: R
}
}
declare namespace /* Interfaces */ I {
export interface Action {
type: string;
error: boolean;
payload: object | null;
meta: object | null;
}
export interface ActionError<
T extends string,
E extends Error,
M extends object | null
> extends Action {
type: T;
error: true;
payload: E;
meta: M;
}
export interface ActionSuccess<
T extends string,
P extends object | null,
M extends object | null
> extends Action {
type: T;
error: false;
payload: P;
meta: M;
}
interface Case<D, S, C> {
(actionType: string): {
case: Case<D, S, C>;
do: Do<D, S, C>;
then: Then<D, S, C>;
catch: Catch<D, S, C>;
};
(action: Action): {
case: Case<D, S, C>;
do: Do<D, S, C>;
then: Then<D, S, C>;
catch: Catch<D, S, C>;
};
(anyToString: { toString(): string }): {
case: Case<D, S, C>;
do: Do<D, S, C>;
then: Then<D, S, C>;
catch: Catch<D, S, C>;
};
}
interface Do<D, S, C> {
<A extends Action>(reducer: (state: S, action: A, config: C) => S): {
default: Default<D, S, C>;
case: Case<D, S, C>;
do: Do<D, S, C>;
then: Then<D, S, C>;
catch: Catch<D, S, C>;
};
}
interface Default<D, S, C> {
(state?: S): {
readonly domain: D;
toString(): D;
<A extends Action>(state: S, action: A): S;
};
<A extends Action>(arg: (state: S, action: A, config: C) => S): {
domain: D;
toString(): D;
<A extends Action>(state: S, action: A): S;
};
}
interface Then<D, S, C> {
<A extends ActionSuccess, AE extends ActionError>(
success: (s: S, a: A, c: C) => S, error?: (s: S, a: AE, c: C) => S
): Do<D, S, C>
}
interface Catch<D, S, C> {
<AE extends ActionError>(error: (s: S, a: AE, c: C) => S): Do<D, S, C>
}
interface ActionCreator<
P extends object = object,
M extends object = object,
T extends string = string
> {
readonly type: string;
toString(): string;
<E extends Error, EM extends M>(payload: E, meta: EM): Readonly<ActionError<T, E, EM>>;
<E extends Error>(payload: E): Readonly<ActionError<T, E, null>>;
<PS extends P, MS extends M>(payload: PS, meta: MS): Readonly<ActionSuccess<T, PS, MS>>;
<PS extends P>(payload: PS): Readonly<ActionSuccess<T, PS, null>>;
<MS extends M>(payload: null | undefined, meta: MS): Readonly<ActionSuccess<T, null, MS>>;
(): Readonly<ActionSuccess<T, null, null>>;
}
}
// eslint-disable-next-line import/no-unresolved
export * from './dist/redux-fluent';

@@ -1,10 +0,7 @@

/* eslint-disable spaced-comment, strict, global-require */
// eslint-disable-next-line spaced-comment
/// <reference path="./index.d.ts" />
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./build/redux-fluent.production.js');
} else {
module.exports = require('./build/redux-fluent.development.js');
}
// eslint-disable-next-line import/no-dynamic-require
module.exports = require(
`./dist/redux-fluent.${process.env.NODE_ENV === 'production' ? 'production' : 'development'}.js`,
);
{
"name": "redux-fluent",
"license": "MIT",
"version": "0.27.2",
"version": "0.99.1",
"homepage": "https://github.com/Code-Y/redux-fluent#readme",
"description": "Tiny and eloquent way to manage a redux-like state manager",
"author": "Code-Y (https://github.com/Code-Y)",
"private": false,
"description": "A Practical and Functional utility for redux",
"author": "Code-Y",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"contributors": [
"Luca Pau <luca.pau82@gmail.com> (https://github.com/Lughino)",
"Giuseppe Mandato <gius.mand.developer@gmail.com> (https://github.com/hitmands)"
"files": [
"/dist",
"CHANGELOG.md",
"LICENSE",
"index.js",
"index.d.ts"
],
"keywords": [
"redux",
"ngrx-store",
"state-management",
"typings"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint ./src/**/*.ts",
"build": "webpack --config webpack.config.js",
"test": "jest --coverage",
"build": "NODE_ENV=production npm run webpack",
"webpack": "webpack --config webpack.config.js",
"cz": "git-cz",
"release": "standard-version && git push --follow-tags origin master"
"release": "standard-version -m \"chore(release): %s [skip ci]\""
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"repository": {

@@ -38,35 +36,59 @@ "type": "git",

},
"contributors": [
"Giuseppe Mandato (https://github.com/hitmands)",
"Luca Pau (https://github.com/Lughino)"
],
"keywords": [
"redux",
"functional programming",
"ramda",
"typings"
],
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"flux-standard-action": "^2.1.1",
"redux": "^4.0.4"
},
"devDependencies": {
"@types/jest": "^21.1.9",
"babel-core": "^6.26.0",
"babel-env": "^2.4.1",
"babel-eslint": "^8.1.2",
"babel-jest": "^22.0.4",
"babel-loader": "^7.1.2",
"commitizen": "^2.9.6",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^4.14.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.5.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1",
"flux-standard-action": "^2.0.1",
"jest": "^21.2.1",
"redux": "^3.7.2",
"standard-version": "^4.3.0",
"webpack": "^3.10.0"
},
"jest": {
"transform": {
"^.+\\.jsx?$": "babel-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?)$",
"moduleFileExtensions": [
"js",
"jsx",
"json"
]
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@commitlint/travis-cli": "^8.2.0",
"@types/chai": "^4.2.6",
"@types/jest": "^24.0.23",
"@types/node": "^13.1.0",
"@types/ramda": "^0.26.38",
"@types/sinon": "^7.5.1",
"@types/sinon-chai": "^3.2.3",
"@typescript-eslint/eslint-plugin": "^2.11.0",
"@typescript-eslint/parser": "^2.11.0",
"awesome-typescript-loader": "^5.2.1",
"chai": "^4.2.0",
"eslint": "^6.7.2",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-chai-friendly": "^0.5.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jest": "^23.1.1",
"flux-standard-action": "^2.1.1",
"gitbook": "^2.6.9",
"gitbook-cli": "^2.3.2",
"gitbook-plugin-codesandbox": "^0.1.1",
"gitbook-plugin-edit-link": "^2.0.2",
"gitbook-plugin-github": "^2.0.0",
"gitbook-plugin-prism": "^2.4.0",
"husky": "^3.1.0",
"jest": "^24.9.0",
"ramda": "^0.26.1",
"redux": "^4.0.4",
"sinon": "^7.5.0",
"sinon-chai": "^3.3.0",
"standard-version": "^7.0.1",
"ts-jest": "^24.2.0",
"typescript": "^3.7.3",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10",
"webpack-node-externals": "^1.7.2"
}
}

@@ -1,76 +0,68 @@

# <a href='https://github.com/Code-Y/redux-fluent'><img src='https://raw.githubusercontent.com/Code-Y/redux-fluent/master/redux-fluent-logo.png' height='60' alt='Redux Fluent Logo' aria-label='https://github.com/Code-Y/redux-fluent' /></a> Redux Fluent
<div align="center">
![redux-fluent](https://github.com/Code-Y/redux-fluent/blob/master/gitbook/redux-fluent-logo.jpg?raw=true)
[![Build Status](https://github.com/Code-Y/redux-fluent/workflows/Build/badge.svg)](https://github.com/Code-Y/redux-fluent/actions?query=workflow%3ABuild)
[![npm version](https://img.shields.io/npm/v/redux-fluent.svg)](https://www.npmjs.com/package/redux-fluent)
[![Build Status](https://travis-ci.org/Code-Y/redux-fluent.svg?branch=master)](https://travis-ci.org/Code-Y/redux-fluent)
[![License](https://img.shields.io/npm/l/redux-fluent.svg)](https://github.com/Code-Y/redux-fluent/blob/master/LICENSE)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![npm downloads](https://img.shields.io/npm/dm/redux-fluent.svg)](https://www.npmjs.com/package/redux-fluent)
[![Code Climate](https://codeclimate.com/github/Code-Y/redux-fluent/badges/gpa.svg)](https://codeclimate.com/github/Code-Y/redux-fluent)
[![Test Coverage](https://api.codeclimate.com/v1/badges/02e8b0d9ba383c19ae50/test_coverage)](https://codeclimate.com/github/Code-Y/redux-fluent/test_coverage)
[![npm version](https://img.shields.io/npm/l/redux-fluent.svg)](https://github.com/Code-Y/redux-fluent/blob/master/LICENSE)
[![Maintainability](https://api.codeclimate.com/v1/badges/2e98502fb6072892995d/maintainability)](https://codeclimate.com/github/Code-Y/redux-fluent/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/2e98502fb6072892995d/test_coverage)](https://codeclimate.com/github/Code-Y/redux-fluent/test_coverage)
#### ....................:::::::::::::::::::....................
#### [...::: TRY OUR COUNTER REDUCER EXAMPLE ON CODESANDBOX :::...](https://codesandbox.io/s/redux-fluent-the-counter-reducer-enoc2?fontsize=14&hidenavigation=1&module=%2Fsrc%2Fstore%2Fcounter%2Fcounter.reducers.ts&theme=dark)
#### ....................:::::::::::::::::::....................
<hr />
</div>
Tiny and eloquent way to manage a redux-like state manager (*3K*, dependencies free, definitions included).
### Installation
[Try it out on RunKit](https://runkit.com/hitmands/redux-fluent-playground)
```
yarn add redux-fluent redux flux-standard-action
```
### Documentation
## Documentation
- https://code-y.github.io/redux-fluent
1. [Action](./docs/Action.MD)
2. [Reducer](./docs/Reducer.MD)
3. [CombinableReducers](./docs/CombinableReducers.MD)
### Getting Started
## Motivation
```typescript
import { createStore } from 'redux';
import { createAction, createReducer, ofType } from 'redux-fluent';
[Redux](https://redux.js.org/) is great, *every recent web application was most likely been built on top of it*, however we really think we can simplify it further and, after our investigation, we came out with:
const increment = createAction('increment');
const decrement = createAction('decrement');
- **Reducers** tend to grow and become hard to maintain, 'cause of the amount of switch-cases.
- Concepts such as **Action**, **Action Type** and **Action Creator** could be squashed into only one.
- [FSA action](https://github.com/acdlite/flux-standard-action#actions) may have `error = true` but this involves `IF Statements` inside reducers, so, developers tend to have separate `cases` via `ACTION_SUCCESS` and `ACTION_ERROR`.
- Uncontrolled scaffolding growth.
const counter = createReducer('counter')
.actions(
ofType(increment).map(state => state + 1),
ofType(decrement).map(state => state - 1),
)
.default(() => 0);
## Installation
const store = createStore(counter);
```bash
npm install --save redux-fluent
store.dispatch(increment());
```
## Getting Started
### Distribution
```javascript
/** todosReducer.js **/
import { createAction, createReducer } from 'redux-fluent';
- https://www.npmjs.com/package/redux-fluent
### Stats
const addTodo = createAction('@@todos | add');
- `3.2 kB` - https://bundlephobia.com/result?p=redux-fluent
const todosReducer = createReducer('@@todos')
.case(addTodo)
.then((state, { payload }) => state.concat(payload))
### Discussion
.default(() => [])
;
- [![Gitter](https://badges.gitter.im/redux-fluent/community.svg)](https://gitter.im/redux-fluent/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
- [StackOverflow](https://stackoverflow.com/questions/tagged/redux-fluent)
- [Github Issues](https://github.com/Code-Y/redux-fluent/issues)
- [Submit a Pull Request](https://github.com/Code-Y/redux-fluent/pulls)
export { todosReducer, addTodo };
```
### License
```javascript
/** application.js **/
import { createStore, combineReducers } from 'redux';
import { createCombinableReducers } from 'redux-fluent';
import { otherReducer } from './otherReducer';
import { todosReducer, addTodo } from './todosReducer';
const reducers = combineReducers(
createCombinableReducers(todosReducer, otherReducer),
);
const store = createStore(reducers);
// You can think of `addTodo` as an action creator itself
store.dispatch(
addTodo({
id: 1,
title: 'Walk Gipsy',
}),
);
```
[MIT](https://github.com/Code-Y/redux-fluent/blob/master/LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc