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

react-json-pretty

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-json-pretty - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="2.1.0"></a>
# [2.1.0](https://github.com/chenckang/react-json-pretty/compare/v2.0.1...v2.1.0) (2019-03-14)
### Features
* add onError hook for JSON.parse ([5b883c8](https://github.com/chenckang/react-json-pretty/commit/5b883c8))
<a name="2.0.1"></a>

@@ -7,0 +17,0 @@ ## [2.0.1](https://github.com/chenckang/react-json-pretty/compare/v2.0.0...v2.0.1) (2019-03-13)

6

dist/JSONPretty.js

@@ -72,3 +72,3 @@ "use strict";

JSONPretty.prototype.render = function () {
var _a = this.props, json = _a.json, data = _a.data, replacer = _a.replacer, space = _a.space, themeClassName = _a.themeClassName, theme = _a.theme, silent = _a.silent, rest = __rest(_a, ["json", "data", "replacer", "space", "themeClassName", "theme", "silent"]);
var _a = this.props, json = _a.json, data = _a.data, replacer = _a.replacer, space = _a.space, themeClassName = _a.themeClassName, theme = _a.theme, onError = _a.onError, silent = _a.silent, rest = __rest(_a, ["json", "data", "replacer", "space", "themeClassName", "theme", "onError", "silent"]);
var obj = data || json;

@@ -84,2 +84,5 @@ // See https://facebook.github.io/react/warnings/unknown-prop.html

}
if (onError) {
onError(e);
}
return (React.createElement("div", __assign({}, rest, { dangerouslySetInnerHTML: { __html: "<pre class=" + themeClassName + getStyle('main', theme) + ">" + xss(obj) + "</pre>"

@@ -134,2 +137,3 @@ } })));

themeClassName: PropTypes.string,
onError: PropTypes.func
};

@@ -136,0 +140,0 @@ JSONPretty.defaultProps = {

8

package.json
{
"name": "react-json-pretty",
"version": "2.0.1",
"version": "2.1.0",
"description": "A code formatting tool for raw json data",

@@ -43,3 +43,2 @@ "main": "dist/JSONPretty.js",

"devDependencies": {
"@types/chai": "^4.1.7",
"@types/enzyme": "^3.1.15",

@@ -51,8 +50,7 @@ "@types/enzyme-adapter-react-16": "^1.0.3",

"@types/react-dom": "^16.0.11",
"chai": "^4.2.0",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"enzyme-adapter-react-16": "^1.9.1",
"enzyme-to-json": "^3.3.5",
"husky": "^1.3.1",
"jest": "^23.6.0",
"jest": "^24.5.0",
"react": "^16.7.0",

@@ -59,0 +57,0 @@ "react-dom": "^16.7.0",

@@ -79,2 +79,10 @@ # React JSON Pretty

### Error
Use `onError` function property to get `JSON.parse` errors.
```jsx
<JSONPretty data={invalid} onError={e => console.error(e)}></JSONPretty>
```
### Formation

@@ -81,0 +89,0 @@

@@ -14,2 +14,3 @@ import * as PropTypes from 'prop-types';

silent?: boolean;
onError?: (e: Error) => void;
}

@@ -25,2 +26,3 @@ declare class JSONPretty extends React.Component<IProps, {}> {

themeClassName: PropTypes.Requireable<string>;
onError: PropTypes.Requireable<(...args: any[]) => any>;
};

@@ -27,0 +29,0 @@ static defaultProps: {

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