Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pretty-format

Package Overview
Dependencies
Maintainers
2
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretty-format - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

plugins/ReactElement.js

2

package.json
{
"name": "pretty-format",
"version": "3.6.0",
"version": "3.7.0",
"description": "Stringify any JavaScript value.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -8,3 +8,3 @@ 'use strict';

function printChildren(children, print, indent) {
return children.map(child => printElement(child, print, indent)).join('\n');
return children.map(child => printInstance(child, print, indent)).join('\n');
}

@@ -29,18 +29,18 @@

function printElement(element, print, indent) {
if (typeof element == 'number') {
return print(element);
} else if (typeof element === 'string') {
return printString(element);
function printInstance(instance, print, indent) {
if (typeof instance == 'number') {
return print(instance);
} else if (typeof instance === 'string') {
return printString(instance);
}
let result = '<' + element.type;
let result = '<' + instance.type;
if (element.props) {
result += printProps(element.props, print, indent);
if (instance.props) {
result += printProps(instance.props, print, indent);
}
if (element.children) {
const children = printChildren(element.children, print, indent);
result += '>\n' + indent(children) + '\n</' + element.type + '>';
if (instance.children) {
const children = printChildren(instance.children, print, indent);
result += '>\n' + indent(children) + '\n</' + instance.type + '>';
} else {

@@ -58,4 +58,4 @@ result += ' />';

print(val, print, indent) {
return printElement(val, print, indent);
return printInstance(val, print, indent);
}
};
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