pretty-format
Advanced tools
Comparing version 3.6.0 to 3.7.0
{ | ||
"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); | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16642
8
364