New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 0.0.6 to 0.0.7

dist/src/debug.d.ts

13

dist/src/actionFactory.d.ts

@@ -1,12 +0,11 @@

import { IState, ICursor } from './store';
export declare type debugCallbackType = (message: string, params?: any) => void;
export declare let bootstrap: (renderCallback: () => void, debugCallback?: (message: string, params?: any) => void) => void;
import * as s from './store';
export declare let bootstrap: (renderCallback: () => void) => void;
export interface IAction<T> {
(param?: T): void;
}
export declare let createAction: <TState extends IState, TParams>(cursor: ICursor<TState>, handler: (state: TState, t?: TParams) => TState) => IAction<TParams>;
export interface IPair<TState extends IState, TParam> {
cursor: ICursor<TState>;
export declare let createAction: <TState extends s.IState, TParams>(cursor: s.ICursor<TState>, handler: (state: TState, t?: TParams) => TState) => IAction<TParams>;
export interface IPair<TState extends s.IState, TParam> {
cursor: s.ICursor<TState>;
handler: (state: TState, t?: TParam) => TState;
}
export declare let createActions: <TState1 extends IState, TParams>(...pairs: IPair<TState1, TParams>[]) => IAction<TParams>;
export declare let createActions: <TState extends s.IState, TParams>(...pairs: IPair<TState, TParams>[]) => IAction<TParams>;

@@ -1,9 +0,7 @@

var store_1 = require('./store');
var s = require('./store');
var d = require('./debug');
var render = null;
var debug = undefined;
exports.bootstrap = function (renderCallback, debugCallback) {
if (debugCallback === void 0) { debugCallback = function (m, p) { }; }
exports.bootstrap = function (renderCallback) {
render = renderCallback;
debug = debugCallback;
debug('Action factory has been initialized.');
d.log('Action factory has been initialized.');
};

@@ -15,3 +13,3 @@ exports.createAction = function (cursor, handler) {

render();
debug('Rendering invoked...');
d.log('Rendering invoked...');
}

@@ -42,9 +40,9 @@ });

function changeState(cursor, handler, params) {
var oldState = store_1.getState(cursor);
var oldState = s.getState(cursor);
var newState = handler(oldState, params);
if (oldState === newState)
return false;
store_1.setState(cursor, newState);
debug('Current state: ', newState);
s.setState(cursor, newState);
d.log('Global state has been changed.');
return true;
}

@@ -1,12 +0,9 @@

import { setState, getState, IState, ICursor } from './store';
import * as s from './store';
import * as d from './debug';
let render: () => void = null;
let debug: debugCallbackType = undefined;
export type debugCallbackType = (message: string, params?: any) => void
export let bootstrap = (renderCallback: () => void, debugCallback: debugCallbackType = (m, p) => {}) => {
export let bootstrap = (renderCallback: () => void) => {
render = renderCallback;
debug = debugCallback;
debug('Action factory has been initialized.');
d.log('Action factory has been initialized.');
};

@@ -18,3 +15,3 @@

export let createAction = <TState extends IState, TParams>(cursor: ICursor<TState>, handler: (state: TState, t?: TParams) => TState)
export let createAction = <TState extends s.IState, TParams>(cursor: s.ICursor<TState>, handler: (state: TState, t?: TParams) => TState)
: IAction<TParams> => {

@@ -25,3 +22,3 @@ return <IAction<TParams>>((params?: TParams): void => {

render();
debug('Rendering invoked...');
d.log('Rendering invoked...');
}

@@ -31,8 +28,8 @@ });

export interface IPair<TState extends IState, TParam> {
cursor: ICursor<TState>;
export interface IPair<TState extends s.IState, TParam> {
cursor: s.ICursor<TState>;
handler: (state: TState, t?: TParam) => TState
}
export let createActions = <TState1 extends IState, TParams>(...pairs: IPair<TState1, TParams>[]) => {
export let createActions = <TState extends s.IState, TParams>(...pairs: IPair<TState, TParams>[]) => {
return <IAction<TParams>>((params?: TParams) => {

@@ -56,12 +53,11 @@ validateRenderCallback();

function changeState<TState extends IState, TParams>(cursor: ICursor<TState>, handler: (state: TState, t?: TParams) => TState, params: TParams)
function changeState<TState extends s.IState, TParams>(cursor: s.ICursor<TState>, handler: (state: TState, t?: TParams) => TState, params: TParams)
: boolean {
let oldState = getState(cursor);
let oldState = s.getState(cursor);
let newState = handler(oldState, params);
if (oldState === newState)
return false;
setState(cursor, newState);
debug('Current state: ', newState);
s.setState(cursor, newState);
d.log('Global state has been changed.');
return true;
}

@@ -1,5 +0,5 @@

import { IState } from './store';
import * as s from './store';
export * from './store';
export * from './actionFactory';
export * from './helpers';
export declare let bootstrap: (defaultState: IState, renderCallback: () => void, debugCallback?: (message: string, params?: any) => void, subStateSeparator?: string) => void;
export declare let bootstrap: (defaultState: s.IState, renderCallback: () => void, debugCallback?: (message: string, params?: any) => void, subStateSeparator?: string) => void;
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var store_1 = require('./store');
var actionFactory_1 = require('./actionFactory');
var s = require('./store');
var af = require('./actionFactory');
var d = require('./debug');
__export(require('./store'));

@@ -12,4 +13,5 @@ __export(require('./actionFactory'));

if (subStateSeparator === void 0) { subStateSeparator = '.'; }
store_1.bootstrap(defaultState, subStateSeparator);
actionFactory_1.bootstrap(renderCallback, function (message, params) { debugCallback && debugCallback("fun-model -> " + message, params); });
debugCallback && d.bootstrap(function (m, p) { return debugCallback("fun-model -> " + m, p); });
s.bootstrap(defaultState, subStateSeparator);
af.bootstrap(renderCallback);
};

@@ -1,4 +0,4 @@

import { IState } from './store';
import { bootstrap as storeBootstrap } from './store';
import { bootstrap as actionFactoryBootstrap, debugCallbackType } from './actionFactory';
import * as s from './store';
import * as af from './actionFactory';
import * as d from './debug';

@@ -9,5 +9,6 @@ export * from './store';

export let bootstrap = (defaultState: IState, renderCallback: () => void, debugCallback: debugCallbackType = undefined, subStateSeparator: string = '.') => {
storeBootstrap(defaultState, subStateSeparator);
actionFactoryBootstrap(renderCallback, (message, params) => { debugCallback && debugCallback(`fun-model -> ${message}`, params) });
export let bootstrap = (defaultState: s.IState, renderCallback: () => void, debugCallback: d.debugCallbackType = undefined, subStateSeparator: string = '.') => {
debugCallback && d.bootstrap((m, p) => debugCallback(`fun-model -> ${m}`, p));
s.bootstrap(defaultState, subStateSeparator);
af.bootstrap(renderCallback);
};
var h = require('./helpers');
var d = require('./debug');
var state = null;

@@ -44,2 +45,3 @@ var stateSeparator = '.';

: setInnerState(state, cursor.key.split(stateSeparator));
d.log('Current state:', state);
};

@@ -46,0 +48,0 @@ function checkSubstate(s, subPath, cursorKey) {

import * as h from './helpers';
import * as d from './debug';

@@ -12,4 +13,4 @@ export interface IState {

let stateSeparator = '.';
let rootStateKey = '';
let rootStateKey = '';
export let rootCursor: ICursor<IState> = {

@@ -63,2 +64,3 @@ key: rootStateKey

: setInnerState(state, cursor.key.split(stateSeparator));
d.log('Current state:', state);
};

@@ -65,0 +67,0 @@

{
"name": "fun-model",
"version": "0.0.6",
"version": "0.0.7",
"description": "fun-model is pure functional implementation of FLUX architecture.",

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

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