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

bounded

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bounded - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

89

index.js

@@ -7,52 +7,63 @@ 'use strict';

exports.default = function (_ref) {
var event$ = _ref.event$,
commandHandler = _ref.commandHandler,
store = _ref.store,
api = _ref.api;
var _react = require('react');
var store$ = new _Subject.Subject();
var _react2 = _interopRequireDefault(_react);
var boundedMiddleware = function boundedMiddleware(store) {
return function (next) {
return function (action) {
event$.next(action);
return next(action);
};
};
};
var _reactRedux = require('react-redux');
var reduxStore = store(boundedMiddleware);
var _merge = require('rxjs/observable/merge');
reduxStore.subscribe(function () {
store$.next(reduxStore.getState());
});
var _Subject = require('rxjs/Subject');
var command$ = new _Subject.Subject();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_merge.merge.apply(undefined, _toConsumableArray(forceArray(commandHandler(command$, store$)))).subscribe(function (e) {
try {
reduxStore.dispatch(e);
} catch (e) {
console.error(e);
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function forceArray(arr) {
if (!Array.isArray(arr)) return [arr];
return arr;
}
exports.default = function (event$, command$) {
return function (_ref) {
var root = _ref.root,
store = _ref.store,
commandHandler = _ref.commandHandler,
processManager = _ref.processManager;
if (store) {
var reduxDispatcher = store.dispatch;
store.dispatch = function (event) {
event$.next(event);
};
event$.subscribe(reduxDispatcher);
}
});
return api({
store: reduxStore,
sendCommand: function sendCommand(e) {
return command$.next(e);
if (commandHandler) {
var store$ = new _Subject.Subject();
if (store) {
store.subscribe(function () {
store$.next(store.getState());
});
}
var handlerArr = commandHandler(command$, store$);
_merge.merge.apply(undefined, _toConsumableArray(forceArray(handlerArr))).subscribe(event$);
}
});
};
var _merge = require('rxjs/observable/merge');
if (processManager) {
var dispatchCommand = function dispatchCommand(command) {
command$.next(command);
};
var _Subject = require('rxjs/Subject');
event$.subscribe(function (e) {
processManager(e, dispatchCommand);
});
}
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function forceArray(arr) {
if (!Array.isArray(arr)) return [arr];
return arr;
}
if (root) {
return function () {
return _react2.default.createElement(_reactRedux.Provider, { store: store }, _react2.default.createElement(root));
};
}
};
};
{
"name": "bounded",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -32,4 +32,5 @@ "main": "index.js",

"dependencies": {
"react": "^15.5.4",
"rxjs": "^5.3.0"
}
}

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

import React from 'react'
import { Provider } from 'react-redux'
import { merge } from 'rxjs/observable/merge'

@@ -9,31 +11,39 @@ import { Subject } from 'rxjs/Subject'

export default function ({ event$, commandHandler, store, api }) {
const store$ = new Subject()
export default (event$, command$) => ({ root, store, commandHandler, processManager }) => {
if (store) {
const reduxDispatcher = store.dispatch
store.dispatch = function (event) {
event$.next(event)
}
event$.subscribe(reduxDispatcher)
}
const boundedMiddleware = store => next => action => {
event$.next(action)
return next(action)
if (commandHandler) {
const store$ = new Subject()
if (store) {
store.subscribe(function () {
store$.next(store.getState())
})
}
const handlerArr = commandHandler(command$, store$)
merge(...forceArray(handlerArr)).subscribe(event$)
}
const reduxStore = store(boundedMiddleware)
if (processManager) {
const dispatchCommand = command => {
command$.next(command)
}
reduxStore.subscribe(function () {
store$.next(reduxStore.getState())
})
const command$ = new Subject()
merge(...forceArray(commandHandler(command$, store$)))
.subscribe(e => {
try {
reduxStore.dispatch(e)
} catch (e) {
console.error(e)
}
event$.subscribe(e => {
processManager(e, dispatchCommand)
})
}
return api({
store: reduxStore,
sendCommand: e => command$.next(e)
})
if (root) {
return () => (
React.createElement(Provider, {store: store},
React.createElement(root)
)
)
}
}
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