New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

redux-reporter

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-reporter - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.babelrc

107

lib/index.js

@@ -1,54 +0,89 @@

import { isFSA } from 'flux-standard-action';
'use strict';
const defaultSelect = ({ meta = {} }) => meta.report;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.crashReporter = exports.errorReporter = undefined;
const reporter = (handler, select = defaultSelect) => ({ getState }) => next => action => {
var _fluxStandardAction = require('flux-standard-action');
const returnValue = next(action);
var _fluxStandardAction2 = _interopRequireDefault(_fluxStandardAction);
if (typeof action === 'function') {
return returnValue;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
if (!isFSA(action)) {
throw Error('Action must be a Flux Standard Action - https://github.com/acdlite/flux-standard-action');
}
var defaultSelect = function defaultSelect(_ref) {
var _ref$meta = _ref.meta;
var meta = _ref$meta === undefined ? {} : _ref$meta;
return meta.report;
};
const report = select(action);
var reporter = function reporter(handler) {
var select = arguments.length <= 1 || arguments[1] === undefined ? defaultSelect : arguments[1];
return function (_ref2) {
var getState = _ref2.getState;
return function (next) {
return function (action) {
if (!report) {
return returnValue;
}
var returnValue = next(action);
handler(report, getState);
if (typeof action === 'function') {
return returnValue;
}
return returnValue;
if (!(0, _fluxStandardAction2.default)(action)) {
throw Error('Action must be a Flux Standard Action - https://github.com/acdlite/flux-standard-action');
}
var report = select(action);
if (!report) {
return returnValue;
}
handler(report, getState);
return returnValue;
};
};
};
};
export const errorReporter = handler => reporter(handler, ({ error, payload }, getState) => {
if (!error) {
return null;
}
if (!payload) {
throw Error('Actions that represent errors need an error object as payload');
}
var errorReporter = exports.errorReporter = function errorReporter(handler) {
return reporter(handler, function (_ref3, getState) {
var error = _ref3.error;
var payload = _ref3.payload;
handler(payload, getState);
if (!error) {
return null;
}
if (!payload) {
throw Error('Actions that represent errors need an error object as payload');
}
return payload;
});
handler(payload, getState);
export const crashReporter = handler => ({ getState }) => next => action => {
let returnValue;
return payload;
});
};
try {
returnValue = next(action);
} catch (err) {
handler(err, getState);
console.error(err);
}
var crashReporter = exports.crashReporter = function crashReporter(handler) {
return function (_ref4) {
var getState = _ref4.getState;
return function (next) {
return function (action) {
var returnValue = void 0;
return returnValue;
try {
returnValue = next(action);
} catch (err) {
handler(err, getState);
console.error(err);
}
return returnValue;
};
};
};
};
export default reporter;
exports.default = reporter;
{
"name": "redux-reporter",
"version": "0.0.1",
"version": "0.0.2",
"description": "Redux middleware for reporting actions to third party APIs.",
"main": "lib/index.js",
"scripts": {
"build": "rm -rf lib/ && babel src --out-dir lib",
"build": "rm -rf lib/ && babel src --babelrc true --out-dir lib",
"prepublish": "npm run build",

@@ -30,2 +30,7 @@ "test": "./node_modules/.bin/mocha test/**/*.test.js",

"babel-cli": "^6.10.1",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"chai": "^3.3.0",

@@ -32,0 +37,0 @@ "eslint": "^3.1.0",

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