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

react-element-to-jsx-string

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-element-to-jsx-string - npm Package Compare versions

Comparing version

to
4.2.0

21

index-dist.js

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

var _fill2 = require('lodash/fill');
var _fill3 = _interopRequireDefault(_fill2);
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

@@ -38,4 +42,2 @@

var _lodash = require('lodash');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -47,2 +49,4 @@

var displayName = _ref.displayName;
var _ref$filterProps = _ref.filterProps;
var filterProps = _ref$filterProps === undefined ? [] : _ref$filterProps;
var _ref$showDefaultProps = _ref.showDefaultProps;

@@ -90,3 +94,6 @@ var showDefaultProps = _ref$showDefaultProps === undefined ? true : _ref$showDefaultProps;

attributes = attributes.concat(props);
attributes = attributes.concat(props).filter(function (_ref3) {
var name = _ref3.name;
return filterProps.indexOf(name) === -1;
});

@@ -196,5 +203,5 @@ attributes.forEach(function (attribute) {

function recurse(_ref3) {
var lvl = _ref3.lvl;
var inline = _ref3.inline;
function recurse(_ref4) {
var lvl = _ref4.lvl;
var inline = _ref4.inline;

@@ -249,3 +256,3 @@ return function (Element) {

function spacer(times) {
return (0, _lodash.fill)(new Array(times), ' ').join('');
return (0, _fill3.default)(new Array(times), ' ').join('');
}

@@ -252,0 +259,0 @@

@@ -459,2 +459,10 @@ /* eslint-env mocha */

it('reactElementToJSXString(<TestComponent />, { filterProps: [\'key\', \'className\'] })', () => {
expect(
reactElementToJSXString(<TestComponent a="b" key="aKey" className="aClass" />, {
filterProps: ['key', 'className']
})
).toEqual('<TestComponent a="b" />');
});
it('reactElementToJSXString(<TestComponent />, { useBooleanShorthandSyntax: false })', () => {

@@ -461,0 +469,0 @@ expect(

@@ -13,2 +13,3 @@ import React from 'react';

displayName,
filterProps = [],
showDefaultProps = true,

@@ -51,3 +52,5 @@ showFunctions = false,

attributes = attributes.concat(props);
attributes = attributes
.concat(props)
.filter(({name}) => filterProps.indexOf(name) === -1);

@@ -54,0 +57,0 @@ attributes.forEach(attribute => {

{
"name": "react-element-to-jsx-string",
"version": "4.1.0",
"version": "4.2.0",
"description": "Turn a ReactElement into the corresponding JSX string.",

@@ -18,2 +18,3 @@ "main": "index-dist.js",

"babel-cli": "^6.10.1",
"babel-plugin-lodash": "^3.2.9",
"babel-preset-es2015": "^6.9.0",

@@ -20,0 +21,0 @@ "babel-preset-react": "^6.11.1",

@@ -70,2 +70,6 @@ # react-element-to-jsx-string

**options.filterProps: array, default []**
Provide an array of props to filter for every component. For example ['key'] will suppress the key="" prop from being added.
**options.showDefaultProps: boolean, default true**

@@ -72,0 +76,0 @@

Sorry, the diff of this file is not supported yet