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
64
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
14.3.2

10

CHANGELOG.md

@@ -0,1 +1,11 @@

## [14.3.2](https://github.com/algolia/react-element-to-jsx-string/compare/v14.3.1...v14.3.2) (2020-10-28)
### Bug Fixes
* **deps:** update dependency is-plain-object to v3.0.1 ([4974512](https://github.com/algolia/react-element-to-jsx-string/commit/4974512273c86c72415376fea89f9d6e07e2b2e5))
* Handle multiple words before trailing space ([#572](https://github.com/algolia/react-element-to-jsx-string/issues/572)) ([e0c082e](https://github.com/algolia/react-element-to-jsx-string/commit/e0c082eb1d1e9fe2ed2918db157079d17af3af09))
## [14.3.1](https://github.com/algolia/react-element-to-jsx-string/compare/v14.3.0...v14.3.1) (2020-01-21)

@@ -2,0 +12,0 @@

41

dist/cjs/index.js

@@ -19,2 +19,4 @@ 'use strict';

function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {

@@ -34,19 +36,32 @@ _typeof = function (obj) {

function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
}
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -372,3 +387,3 @@

return createNumberTreeNode(element);
} else if (!React__default.isValidElement(element)) {
} else if (! /*#__PURE__*/React__default.isValidElement(element)) {
throw new Error("react-element-to-jsx-string: Expected a React.Element, got `".concat(_typeof(element), "`"));

@@ -432,3 +447,3 @@ }

if (currentValue && React.isValidElement(currentValue)) {
if (currentValue && /*#__PURE__*/React.isValidElement(currentValue)) {
return formatTreeNode(parseReactElement(currentValue, options), true, lvl, options);

@@ -483,3 +498,3 @@ }

if (React.isValidElement(propValue)) {
if ( /*#__PURE__*/React.isValidElement(propValue)) {
return "{".concat(formatTreeNode(parseReactElement(propValue, options), true, lvl, options), "}");

@@ -788,7 +803,7 @@ }

if (result.endsWith(' ')) {
result = result.replace(/^(\S*)(\s*)$/, "$1{'$2'}");
result = result.replace(/^(.*?)(\s+)$/, "$1{'$2'}");
}
if (result.startsWith(' ')) {
result = result.replace(/^(\s*)(\S*)$/, "{'$1'}$2");
result = result.replace(/^(\s+)(.*)$/, "{'$1'}$2");
}

@@ -795,0 +810,0 @@

@@ -12,2 +12,4 @@ import React, { Fragment, isValidElement } from 'react';

function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {

@@ -27,19 +29,32 @@ _typeof = function (obj) {

function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
}
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -365,3 +380,3 @@

return createNumberTreeNode(element);
} else if (!React.isValidElement(element)) {
} else if (! /*#__PURE__*/React.isValidElement(element)) {
throw new Error("react-element-to-jsx-string: Expected a React.Element, got `".concat(_typeof(element), "`"));

@@ -425,3 +440,3 @@ }

if (currentValue && isValidElement(currentValue)) {
if (currentValue && /*#__PURE__*/isValidElement(currentValue)) {
return formatTreeNode(parseReactElement(currentValue, options), true, lvl, options);

@@ -476,3 +491,3 @@ }

if (isValidElement(propValue)) {
if ( /*#__PURE__*/isValidElement(propValue)) {
return "{".concat(formatTreeNode(parseReactElement(propValue, options), true, lvl, options), "}");

@@ -781,7 +796,7 @@ }

if (result.endsWith(' ')) {
result = result.replace(/^(\S*)(\s*)$/, "$1{'$2'}");
result = result.replace(/^(.*?)(\s+)$/, "$1{'$2'}");
}
if (result.startsWith(' ')) {
result = result.replace(/^(\s*)(\S*)$/, "{'$1'}$2");
result = result.replace(/^(\s+)(.*)$/, "{'$1'}$2");
}

@@ -788,0 +803,0 @@

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

@@ -39,13 +39,13 @@ "main": "dist/cjs/index.js",

"devDependencies": {
"@babel/cli": "7.6.4",
"@babel/core": "7.6.4",
"@babel/preset-env": "7.6.3",
"@babel/preset-flow": "7.0.0",
"@babel/preset-react": "7.6.3",
"@babel/cli": "7.10.4",
"@babel/core": "7.10.4",
"@babel/preset-env": "7.10.4",
"@babel/preset-flow": "7.10.4",
"@babel/preset-react": "7.10.4",
"@commitlint/cli": "8.3.5",
"@commitlint/config-angular": "8.3.4",
"babel-eslint": "10.0.3",
"babel-eslint": "10.1.0",
"babel-jest": "24.9.0",
"babel-register": "6.26.0",
"conventional-changelog-cli": "2.0.31",
"conventional-changelog-cli": "2.0.34",
"doctoc": "1.4.0",

@@ -56,10 +56,10 @@ "enzyme": "3.11.0",

"eslint-config-algolia": "14.0.1",
"eslint-config-prettier": "6.9.0",
"eslint-plugin-import": "2.20.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-jest": "22.21.0",
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-react": "7.18.0",
"eslint-plugin-prettier": "3.1.4",
"eslint-plugin-react": "7.20.3",
"esm": "3.2.25",
"expect": "24.9.0",
"flow-bin": "0.116.1",
"flow-bin": "0.119.1",
"flow-copy-source": "2.0.9",

@@ -69,10 +69,10 @@ "husky": "3.1.0",

"json": "9.0.6",
"lint-staged": "10.0.0",
"lint-staged": "10.2.11",
"mversion": "1.13.0",
"prettier": "1.19.1",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-test-renderer": "16.12.0",
"rollup": "1.29.0",
"rollup-plugin-babel": "4.3.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-test-renderer": "16.13.1",
"rollup": "1.32.1",
"rollup-plugin-babel": "4.4.0",
"rollup-plugin-commonjs": "10.1.0",

@@ -82,11 +82,11 @@ "rollup-plugin-node-builtins": "2.1.2",

"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-sourcemaps": "0.5.0"
"rollup-plugin-sourcemaps": "0.6.2"
},
"peerDependencies": {
"react": "^0.14.8 || ^15.0.1 || ^16.0.0",
"react-dom": "^0.14.8 || ^15.0.1 || ^16.0.0"
"react": "^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1",
"react-dom": "^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1"
},
"dependencies": {
"@base2/pretty-print-object": "1.0.0",
"is-plain-object": "3.0.0"
"is-plain-object": "3.0.1"
},

@@ -93,0 +93,0 @@ "jest": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet