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

fun-model

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fun-model - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

9

CHANGELOG.md
CHANGELOG
===
4.2.0
--
New Features
-
Actions in setter variant. Function createAction has a default handler working as setter.
4.1.0

@@ -4,0 +13,0 @@ --

2

package.json
{
"name": "fun-model",
"version": "4.1.0",
"version": "4.2.0",
"description": "fun-model is pure functional implementation of FLUX architecture.",

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

@@ -199,2 +199,10 @@ "use strict";

});
it('uses action as simple setter when no handler defined', function () {
givenStore(aState('nestedStateValue'));
var testAction = af.createAction(NestedStateCursorTestFixture);
testAction('nestedStateValue');
expect(renderCallback).not.toHaveBeenCalled();
testAction('newNestedStateValue');
expect(renderCallback).toHaveBeenCalled();
});
});

@@ -218,4 +226,7 @@ });

};
var NestedStateCursorTestFixture = {
key: 'some.nested.state'
};
var SomeCursorTestFixture = {
key: 'some'
};

@@ -256,2 +256,13 @@ import * as s from '../src/store';

});
it('uses action as simple setter when no handler defined', () => {
givenStore(aState('nestedStateValue'));
const testAction = af.createAction<string, string>(NestedStateCursorTestFixture);
testAction('nestedStateValue');
expect(renderCallback).not.toHaveBeenCalled();
testAction('newNestedStateValue');
expect(renderCallback).toHaveBeenCalled();
});
});

@@ -290,4 +301,8 @@ });

var NestedStateCursorTestFixture: s.ICursor<string> = {
key: 'some.nested.state'
}
var SomeCursorTestFixture: s.ICursor<ISomeState> = {
key: 'some'
}

@@ -14,3 +14,5 @@ "use strict";

};
function defaultHandler(_oldValue, newValue) { return newValue; }
exports.createAction = function (cursor, handler) {
if (handler === void 0) { handler = defaultHandler; }
return (function (params) {

@@ -17,0 +19,0 @@ if (stateChanged === null)

@@ -21,3 +21,5 @@ import * as s from './store';

export const createAction = <TState extends s.IState, TParams>(cursor: s.ICursor<TState> | s.ICursorFactory<TState, TParams>, handler: IActionHandler<TState, TParams>)
function defaultHandler<TValue>(_oldValue: TValue, newValue: TValue) { return newValue; }
export const createAction = <TState extends s.IState, TParams>(cursor: s.ICursor<TState> | s.ICursorFactory<TState, TParams>, handler: IActionHandler<TState, TParams> = defaultHandler)
: IAction<TParams> => {

@@ -24,0 +26,0 @@ return <IAction<TParams>>((params?: TParams): void => {

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