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

react-badly

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-badly - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

12

dist/index.js
/**
* react-badly v0.0.1
* react-badly v0.1.0
* https://github.com/maniator/react-badly#readme

@@ -24,2 +24,6 @@ * @author Neal Lubin <naftalilubin@gmail.com>

var dummyFunc = function dummyFunc() {
return null;
};
var ReactBadly = function (_PureComponent) {

@@ -51,5 +55,3 @@ _inherits(ReactBadly, _PureComponent);

value: function componentDidCatch(error, info) {
var errorHandler = this.props.onError || function () {
return null;
};
var errorHandler = this.props.onError || dummyFunc;

@@ -80,3 +82,3 @@ this.setState({ hasError: true, errorInformation: { error: error, info: info } }, function () {

children: PropTypes.node.isRequired,
hasError: PropTypes.func,
onError: PropTypes.func,
render: PropTypes.func

@@ -83,0 +85,0 @@ };

/**
* react-badly v0.0.1
* react-badly v0.1.0
* https://github.com/maniator/react-badly#readme

@@ -7,2 +7,2 @@ * @author Neal Lubin <naftalilubin@gmail.com>

*/
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],r):r(e.ReactBadly={},e.react,e.PropTypes)}(this,function(e,r,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}();function o(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}var i=function(e){function t(){var e,r,n;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,a=Array(i),u=0;u<i;u++)a[u]=arguments[u];return r=n=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),Object.defineProperty(n,"state",{enumerable:!0,writable:!0,value:{hasError:!1}}),o(n,r)}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}(t,r.PureComponent),n(t,[{key:"componentDidCatch",value:function(e,r){var t=this.props.onError||function(){return null};this.setState({hasError:!0,errorInformation:{error:e,info:r}},function(){t(e,r)})}},{key:"render",value:function(){return this.state.hasError?this.props.render?this.props.render(this.state.errorInformation):null:this.props.children}}]),t}();i.propTypes={children:t.node.isRequired,hasError:t.func,render:t.func},e.ReactBadly=i,e.default=i,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],r):r(e.ReactBadly={},e.react,e.PropTypes)}(this,function(e,r,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}();function o(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}var i=function(){return null},a=function(e){function t(){var e,r,n;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,a=Array(i),u=0;u<i;u++)a[u]=arguments[u];return r=n=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),Object.defineProperty(n,"state",{enumerable:!0,writable:!0,value:{hasError:!1}}),o(n,r)}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}(t,r.PureComponent),n(t,[{key:"componentDidCatch",value:function(e,r){var t=this.props.onError||i;this.setState({hasError:!0,errorInformation:{error:e,info:r}},function(){t(e,r)})}},{key:"render",value:function(){return this.state.hasError?this.props.render?this.props.render(this.state.errorInformation):null:this.props.children}}]),t}();a.propTypes={children:t.node.isRequired,onError:t.func,render:t.func},e.ReactBadly=a,e.default=a,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -24,2 +24,6 @@ 'use strict';

var dummyFunc = function dummyFunc() {
return null;
};
var ReactBadly = exports.ReactBadly = function (_PureComponent) {

@@ -53,5 +57,3 @@ _inherits(ReactBadly, _PureComponent);

value: function componentDidCatch(error, info) {
var errorHandler = this.props.onError || function () {
return null;
};
var errorHandler = this.props.onError || dummyFunc;

@@ -85,4 +87,4 @@ this.setState({ hasError: true, errorInformation: { error: error, info: info } }, function () {

children: _propTypes2.default.node.isRequired,
hasError: _propTypes2.default.func,
onError: _propTypes2.default.func,
render: _propTypes2.default.func
};
{
"name": "react-badly",
"version": "0.0.1",
"version": "0.1.0",
"description": "Error boundary react component",

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

@@ -64,6 +64,8 @@ # react-badly

const renderError = ({ error, info }) => ([
<h2>You have an error!</h2>,
<pre>{JSON.stringify(error)}'\n'{JSON.stringify(info)}</pre>
]);
const renderError = ({ error, info }) => (
<React.Fragment>
<h2>You have an error!</h2>
<pre>{JSON.stringify(error)}'\n'{JSON.stringify(info)}</pre>
</React.Fragment>
);

@@ -70,0 +72,0 @@ // some code later on

import { PureComponent } from 'react';
import PropTypes from 'prop-types';
const dummyFunc = () => null;
export class ReactBadly extends PureComponent {

@@ -10,3 +12,3 @@ state = {

componentDidCatch (error, info) {
const errorHandler = this.props.onError || (() => null);
const errorHandler = this.props.onError || dummyFunc;

@@ -35,4 +37,4 @@ this.setState({ hasError: true, errorInformation: { error, info } }, () => {

children: PropTypes.node.isRequired,
hasError: PropTypes.func,
onError: PropTypes.func,
render: PropTypes.func,
};

Sorry, the diff of this file is not supported yet

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