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.0 to 2.0.1

10

CHANGELOG.md

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

<a name="2.0.1"></a>
## [2.0.1](https://github.com/chenckang/react-json-pretty/compare/v2.0.0...v2.0.1) (2019-03-13)
### Bug Fixes
* xss security issue under invalid json data ([66526b9](https://github.com/chenckang/react-json-pretty/commit/66526b9))
<a name="2.0.0"></a>

@@ -7,0 +17,0 @@ # [2.0.0](https://github.com/chenckang/react-json-pretty/compare/v1.7.9...v2.0.0) (2019-01-03)

23

dist/JSONPretty.js

@@ -44,5 +44,24 @@ "use strict";

var React = __importStar(require("react"));
function getStyleValue(name, theme) {
return theme ? theme[name] || '' : '';
}
function getStyle(name, theme) {
return theme ? theme[name] ? " style=\"" + theme[name] + "\"" : '' : '';
var value = getStyleValue(name, theme);
return value ? " style=\"" + value + "\"" : '';
}
var xssmap = {
'"': '&quot;',
'\'': '&apos;',
'&': '&amp;',
'>': '&gt;',
'<': '&lt',
};
function xss(s) {
if (!s) {
return s;
}
return s.replace(/<|>|&|"|'/g, function (m) {
return xssmap[m];
});
}
var JSONPretty = /** @class */ (function (_super) {

@@ -65,3 +84,3 @@ __extends(JSONPretty, _super);

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

@@ -68,0 +87,0 @@ }

4

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

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

"test": "jest --verbose=true --coverage",
"build": "npm run build-styl && npm run build-jsx",
"build": "mkdir -p dist && mkdir -p themes && npm run build-styl && npm run build-jsx",
"lint": "tslint --project tsconfig.json --config tslint.json './src/**/*.tsx'",

@@ -19,0 +19,0 @@ "precommit": "npm run build && npm run lint",

@@ -44,3 +44,3 @@ # React JSON Pretty

***Note: if `yourData` is not a plain object, use `circular-json` or other similar tools to preprocess it before passed to `JSONPretty`.***
***Note: if `yourData` is not a plain object, use `circular-json` or other similar tools to preprocess it before being passed to `JSONPretty`.***

@@ -47,0 +47,0 @@ ### Themes

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