react-element-to-jsx-string
Advanced tools
Comparing version
@@ -0,1 +1,12 @@ | ||
<a name="14.0.2"></a> | ||
## [14.0.2](https://github.com/algolia/react-element-to-jsx-string/compare/v14.0.1...v14.0.2) (2018-10-10) | ||
### Bug Fixes | ||
* **formatting:** Fix JSX element in prop object recursive loop ([#309](https://github.com/algolia/react-element-to-jsx-string/issues/309)) ([fd4f53b](https://github.com/algolia/react-element-to-jsx-string/commit/fd4f53b)) | ||
* **functionValue:** handle nested datastructures ([94d1aeb](https://github.com/algolia/react-element-to-jsx-string/commit/94d1aeb)) | ||
<a name="14.0.1"></a> | ||
@@ -2,0 +13,0 @@ ## [14.0.1](https://github.com/algolia/react-element-to-jsx-string/compare/v14.0.0...v14.0.1) (2018-06-20) |
@@ -226,2 +226,5 @@ 'use strict'; | ||
return Object.keys(value).sort().reduce(function (result, key) { | ||
if (key === '_owner') { | ||
return result; | ||
} | ||
// eslint-disable-next-line no-param-reassign | ||
@@ -338,2 +341,18 @@ result[key] = sortObject(value[key]); | ||
var defaultFunctionValue = function defaultFunctionValue(fn) { | ||
return fn.toString(); | ||
}; | ||
var formatFunction = (function (fn, options) { | ||
var _options$functionValu = options.functionValue, | ||
functionValue = _options$functionValu === undefined ? defaultFunctionValue : _options$functionValu, | ||
showFunctions = options.showFunctions; | ||
if (!showFunctions && functionValue === defaultFunctionValue) { | ||
return functionValue(noRefCheck); | ||
} | ||
return functionValue(fn); | ||
}); | ||
var formatComplexDataStructure = (function (value, inline, lvl, options) { | ||
@@ -351,3 +370,3 @@ var normalizedValue = sortObject(value); | ||
if (typeof currentValue === 'function') { | ||
return noRefCheck; | ||
return formatFunction(currentValue, options); | ||
} | ||
@@ -369,3 +388,2 @@ | ||
var noRefCheck$1 = function noRefCheck() {}; | ||
var escape = function escape(s) { | ||
@@ -375,6 +393,2 @@ return s.replace(/"/g, '"'); | ||
var defaultFunctionValue = function defaultFunctionValue(fn) { | ||
return fn; | ||
}; | ||
var formatPropValue = function formatPropValue(propValue, inline, lvl, options) { | ||
@@ -403,11 +417,3 @@ if (typeof propValue === 'number') { | ||
if (typeof propValue === 'function') { | ||
var _options$functionValu = options.functionValue, | ||
functionValue = _options$functionValu === undefined ? defaultFunctionValue : _options$functionValu, | ||
showFunctions = options.showFunctions; | ||
if (!showFunctions && functionValue === defaultFunctionValue) { | ||
return '{' + functionValue(noRefCheck$1) + '}'; | ||
} | ||
return '{' + functionValue(propValue) + '}'; | ||
return '{' + formatFunction(propValue, options) + '}'; | ||
} | ||
@@ -414,0 +420,0 @@ |
@@ -221,2 +221,5 @@ import React, { Fragment, isValidElement } from 'react'; | ||
return Object.keys(value).sort().reduce(function (result, key) { | ||
if (key === '_owner') { | ||
return result; | ||
} | ||
// eslint-disable-next-line no-param-reassign | ||
@@ -333,2 +336,18 @@ result[key] = sortObject(value[key]); | ||
var defaultFunctionValue = function defaultFunctionValue(fn) { | ||
return fn.toString(); | ||
}; | ||
var formatFunction = (function (fn, options) { | ||
var _options$functionValu = options.functionValue, | ||
functionValue = _options$functionValu === undefined ? defaultFunctionValue : _options$functionValu, | ||
showFunctions = options.showFunctions; | ||
if (!showFunctions && functionValue === defaultFunctionValue) { | ||
return functionValue(noRefCheck); | ||
} | ||
return functionValue(fn); | ||
}); | ||
var formatComplexDataStructure = (function (value, inline, lvl, options) { | ||
@@ -346,3 +365,3 @@ var normalizedValue = sortObject(value); | ||
if (typeof currentValue === 'function') { | ||
return noRefCheck; | ||
return formatFunction(currentValue, options); | ||
} | ||
@@ -364,3 +383,2 @@ | ||
var noRefCheck$1 = function noRefCheck() {}; | ||
var escape = function escape(s) { | ||
@@ -370,6 +388,2 @@ return s.replace(/"/g, '"'); | ||
var defaultFunctionValue = function defaultFunctionValue(fn) { | ||
return fn; | ||
}; | ||
var formatPropValue = function formatPropValue(propValue, inline, lvl, options) { | ||
@@ -398,11 +412,3 @@ if (typeof propValue === 'number') { | ||
if (typeof propValue === 'function') { | ||
var _options$functionValu = options.functionValue, | ||
functionValue = _options$functionValu === undefined ? defaultFunctionValue : _options$functionValu, | ||
showFunctions = options.showFunctions; | ||
if (!showFunctions && functionValue === defaultFunctionValue) { | ||
return '{' + functionValue(noRefCheck$1) + '}'; | ||
} | ||
return '{' + functionValue(propValue) + '}'; | ||
return '{' + formatFunction(propValue, options) + '}'; | ||
} | ||
@@ -409,0 +415,0 @@ |
{ | ||
"name": "react-element-to-jsx-string", | ||
"version": "14.0.1", | ||
"version": "14.0.2", | ||
"description": "Turn a ReactElement into the corresponding JSX string.", | ||
@@ -38,6 +38,6 @@ "main": "dist/cjs/index.js", | ||
"devDependencies": { | ||
"@commitlint/cli": "7.0.0", | ||
"@commitlint/config-angular": "7.0.1", | ||
"@commitlint/cli": "7.2.0", | ||
"@commitlint/config-angular": "7.1.2", | ||
"babel-cli": "6.26.0", | ||
"babel-eslint": "8.2.3", | ||
"babel-eslint": "10.0.1", | ||
"babel-jest": "22.2.2", | ||
@@ -49,30 +49,32 @@ "babel-preset-es2015": "6.24.1", | ||
"babel-register": "6.26.0", | ||
"conventional-changelog-cli": "2.0.1", | ||
"conventional-changelog-cli": "2.0.5", | ||
"doctoc": "1.3.1", | ||
"eslint": "4.19.1", | ||
"eslint-config-algolia": "13.1.0", | ||
"eslint-config-prettier": "2.9.0", | ||
"eslint-plugin-import": "2.12.0", | ||
"eslint-plugin-jest": "21.17.0", | ||
"eslint-plugin-prettier": "2.6.0", | ||
"eslint-plugin-react": "7.9.1", | ||
"esm": "^3.0.51", | ||
"enzyme": "3.7.0", | ||
"enzyme-adapter-react-16": "1.6.0", | ||
"eslint": "5.6.1", | ||
"eslint-config-algolia": "13.2.3", | ||
"eslint-config-prettier": "3.1.0", | ||
"eslint-plugin-import": "2.14.0", | ||
"eslint-plugin-jest": "21.24.1", | ||
"eslint-plugin-prettier": "2.7.0", | ||
"eslint-plugin-react": "7.11.1", | ||
"esm": "3.0.84", | ||
"expect": "22.3.0", | ||
"flow-bin": "0.74.0", | ||
"flow-copy-source": "2.0.0", | ||
"husky": "0.14.3", | ||
"flow-bin": "0.82.0", | ||
"flow-copy-source": "2.0.2", | ||
"husky": "1.1.1", | ||
"jest": "22.3.0", | ||
"json": "9.0.6", | ||
"lint-staged": "7.2.0", | ||
"mversion": "1.10.1", | ||
"lint-staged": "7.3.0", | ||
"mversion": "1.12.0", | ||
"prettier": "1.8.2", | ||
"react": "16.4.1", | ||
"react-dom": "16.4.1", | ||
"react-test-renderer": "16.4.1", | ||
"rollup": "0.60.7", | ||
"rollup-plugin-babel": "3.0.4", | ||
"rollup-plugin-commonjs": "9.1.3", | ||
"react": "16.5.2", | ||
"react-dom": "16.5.2", | ||
"react-test-renderer": "16.5.2", | ||
"rollup": "0.66.4", | ||
"rollup-plugin-babel": "3.0.7", | ||
"rollup-plugin-commonjs": "9.1.8", | ||
"rollup-plugin-node-builtins": "2.1.2", | ||
"rollup-plugin-node-globals": "1.2.1", | ||
"rollup-plugin-node-resolve": "3.3.0", | ||
"rollup-plugin-node-globals": "1.4.0", | ||
"rollup-plugin-node-resolve": "3.4.0", | ||
"rollup-plugin-sourcemaps": "0.4.2" | ||
@@ -87,3 +89,6 @@ }, | ||
"stringify-object": "3.2.2" | ||
}, | ||
"jest": { | ||
"setupTestFrameworkScriptFile": "<rootDir>tests/setupTests.js" | ||
} | ||
} |
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
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
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
496677
1.85%48
4.35%41
5.13%1393
-15.58%3
50%