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

preact-render-to-string

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

preact-render-to-string - npm Package Compare versions

Comparing version 3.0.5 to 3.0.6

36

dist/index.js

@@ -117,2 +117,6 @@ (function (global, factory) {

if (vnode == null) {
return '<!---->';
}
if (!nodeName) {

@@ -202,19 +206,19 @@ return encodeEntities(vnode);

} else {
var len = children && children.length;
if (len) {
var pieces = [],
hasLarge = ~s.indexOf('\n');
for (var _i = 0; _i < len; _i++) {
var child = children[_i];
if (!falsey(child)) {
var ret = renderToString(child, context, opts, true);
if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
pieces.push(ret);
}
var len = children && children.length,
pieces = [],
hasLarge = ~s.indexOf('\n');
for (var _i = 0; _i < len; _i++) {
var child = children[_i];
if (!falsey(child)) {
var ret = renderToString(child, context, opts, true);
if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
pieces.push(ret);
}
if (hasLarge) {
for (var _i2 = pieces.length; _i2--;) {
pieces[_i2] = '\n' + indentChar + indent(pieces[_i2], indentChar);
}
}
if (hasLarge) {
for (var _i2 = pieces.length; _i2--;) {
pieces[_i2] = '\n' + indentChar + indent(pieces[_i2], indentChar);
}
}
if (pieces.length) {
s += pieces.join('');

@@ -226,3 +230,3 @@ } else if (opts && opts.xml) {

if (VOID_ELEMENTS.indexOf(nodeName) === -1) {
if (opts.jsx || VOID_ELEMENTS.indexOf(nodeName) === -1) {
if (pretty && ~s.indexOf('\n')) s += '\n';

@@ -229,0 +233,0 @@ s += '</' + nodeName + '>';

@@ -129,2 +129,6 @@ (function (global, factory) {

if (vnode == null) {
return '<!---->';
}
if (!nodeName) {

@@ -214,19 +218,19 @@ return encodeEntities(vnode);

} else {
var len = children && children.length;
if (len) {
var pieces = [],
hasLarge = ~s.indexOf('\n');
for (var _i = 0; _i < len; _i++) {
var child = children[_i];
if (!falsey(child)) {
var ret = renderToString(child, context, opts, true);
if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
pieces.push(ret);
}
var len = children && children.length,
pieces = [],
hasLarge = ~s.indexOf('\n');
for (var _i = 0; _i < len; _i++) {
var child = children[_i];
if (!falsey(child)) {
var ret = renderToString(child, context, opts, true);
if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
pieces.push(ret);
}
if (hasLarge) {
for (var _i2 = pieces.length; _i2--;) {
pieces[_i2] = '\n' + indentChar + indent(pieces[_i2], indentChar);
}
}
if (hasLarge) {
for (var _i2 = pieces.length; _i2--;) {
pieces[_i2] = '\n' + indentChar + indent(pieces[_i2], indentChar);
}
}
if (pieces.length) {
s += pieces.join('');

@@ -238,3 +242,3 @@ } else if (opts && opts.xml) {

if (VOID_ELEMENTS.indexOf(nodeName) === -1) {
if (opts.jsx || VOID_ELEMENTS.indexOf(nodeName) === -1) {
if (pretty && ~s.indexOf('\n')) s += '\n';

@@ -241,0 +245,0 @@ s += '</' + nodeName + '>';

{
"name": "preact-render-to-string",
"amdName": "preactRenderToString",
"version": "3.0.5",
"version": "3.0.6",
"description": "Render JSX to an HTML string, with support for Preact components.",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

@@ -60,2 +60,6 @@ import { objectKeys, encodeEntities, falsey, memoize, indent, isLargeString, styleObjToCss, assign, getNodeProps } from './util';

if (vnode==null) {
return '<!---->';
}
// #text nodes

@@ -157,19 +161,19 @@ if (!nodeName) {

else {
let len = children && children.length;
if (len) {
let pieces = [],
hasLarge = ~s.indexOf('\n');
for (let i=0; i<len; i++) {
let child = children[i];
if (!falsey(child)) {
let ret = renderToString(child, context, opts, true);
if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
pieces.push(ret);
}
let len = children && children.length,
pieces = [],
hasLarge = ~s.indexOf('\n');
for (let i=0; i<len; i++) {
let child = children[i];
if (!falsey(child)) {
let ret = renderToString(child, context, opts, true);
if (!hasLarge && pretty && isLargeString(ret)) hasLarge = true;
pieces.push(ret);
}
if (hasLarge) {
for (let i=pieces.length; i--; ) {
pieces[i] = '\n' + indentChar + indent(pieces[i], indentChar);
}
}
if (hasLarge) {
for (let i=pieces.length; i--; ) {
pieces[i] = '\n' + indentChar + indent(pieces[i], indentChar);
}
}
if (pieces.length) {
s += pieces.join('');

@@ -182,3 +186,3 @@ }

if (VOID_ELEMENTS.indexOf(nodeName) === -1) {
if (opts.jsx || VOID_ELEMENTS.indexOf(nodeName)===-1) {
if (pretty && ~s.indexOf('\n')) s += '\n';

@@ -185,0 +189,0 @@ s += `</${nodeName}>`;

@@ -108,2 +108,21 @@ import render from '../src/jsx';

});
it('should render empty resolved children identically to no children', () => {
const Empty = () => null;
expect(renderJsx(
<div>
<a />
<b>{null}</b>
<c><Empty /></c>
</div>
)).to.equal(dedent`
<div>
<a />
<b />
<c>
<!---->
</c>
</div>
`);
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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