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 1.2.0 to 1.2.1

2

example/app/Example.jsx

@@ -21,3 +21,3 @@ var React = require('react');

var JSONPretty = require('react-json-pretty/JSONPretty.jsx');
var JSONPretty = require('react-json-pretty');
require('react-json-pretty/JSONPretty.monikai.styl');

@@ -24,0 +24,0 @@

@@ -29,4 +29,6 @@ var React = require('react');

render: function () {
var json = this.props.json;
// See https://facebook.github.io/react/warnings/unknown-prop.html
var { json, ...rest } = this.props;
if (typeof json === 'string') {

@@ -42,3 +44,3 @@ try {

return (
<pre {...this.props} className='json-pretty' dangerouslySetInnerHTML={{__html: this._pretty(json)}}>
<pre {...rest} className='json-pretty' dangerouslySetInnerHTML={{__html: this._pretty(json)}}>
</pre>

@@ -45,0 +47,0 @@ );

{
"name": "react-json-pretty",
"version": "1.2.0",
"version": "1.2.1",
"description": "A code formatting tool for raw json data",

@@ -10,3 +10,3 @@ "main": "src/JSONPretty.js",

"build-styl": "stylus --compress < JSONPretty.monikai.styl > src/JSONPretty.monikai.css",
"build-jsx": "babel JSONPretty.jsx -d src"
"build-jsx": "babel --presets es2015 --plugins 'transform-object-rest-spread' JSONPretty.jsx -d src"
},

@@ -29,10 +29,11 @@ "keywords": [

"babel-loader": "^6.2.0",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.3.13",
"stylus": "^0.53.0"
},
"repository":
{
"type" : "git",
"url" : "https://github.com/chenckang/react-json-pretty"
"repository": {
"type": "git",
"url": "https://github.com/chenckang/react-json-pretty"
}
}
# React JSON Pretty
[![npm version](https://badge.fury.io/js/react-json-pretty.svg)](https://badge.fury.io/js/react-json-pretty)
[![npm downloads](https://img.shields.io/npm/dm/react-json-pretty.svg)](https://www.npmjs.com/package/react-json-pretty)
![MIT license](https://img.shields.io/github/license/mashape/apistatus.svg)

@@ -31,3 +33,3 @@ ## Introduction

And also you can import the style to the document, here is an example of using webpack loaders(`style!css!stylus`) to load style, You can visit (webpack)[https://webpack.github.io/] to get more details:
And also you can import the style to the document, here is an example of using webpack loaders(`style!css!stylus`) to load style, You can visit [webpack](https://webpack.github.io/) to get more details:

@@ -44,3 +46,3 @@ require('react-json-pretty/JSONPretty.monikai.styl');

![previews, you can also find it in the example folder](http://chenckang.github.io/labs/imgs/preview.png)
![previews, you can also find it in the example folder](http://imgs.co/u/16/07/18/VjeAR.png)

@@ -51,2 +53,2 @@ Have your fun!

MIT (http://www.opensource.org/licenses/mit-license.php)
MIT (http://www.opensource.org/licenses/mit-license.php)

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

'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var React = require('react');

@@ -9,3 +13,3 @@

// 格式化函数
_replace: function (match, ind, key, val, tra) {
_replace: function _replace(match, ind, key, val, tra) {
var spanEnd = '</span>';

@@ -25,3 +29,3 @@ var keySpan = '<span class=json-key>';

// JSON =》 HTML转换器
_pretty: function (obj) {
_pretty: function _pretty(obj) {
// 逐行匹配,列举:“key”: "value" | "key": value | "key": [ | "key": { | "key": [],| "Key": {},

@@ -31,5 +35,10 @@ var regLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([,[{]|\[\s*\],?|\{\s*\},?)?$/mg;

},
render: function () {
var json = this.props.json;
render: function render() {
// See https://facebook.github.io/react/warnings/unknown-prop.html
var _props = this.props;
var json = _props.json;
var rest = _objectWithoutProperties(_props, ['json']);
if (typeof json === 'string') {

@@ -43,4 +52,4 @@ try {

return React.createElement('pre', _extends({}, this.props, { className: 'json-pretty', dangerouslySetInnerHTML: { __html: this._pretty(json) } }));
return React.createElement('pre', _extends({}, rest, { className: 'json-pretty', dangerouslySetInnerHTML: { __html: this._pretty(json) } }));
}
});

Sorry, the diff of this file is too big to display

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