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

html-element-to-react

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-element-to-react - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

24

dist/index.js

@@ -35,10 +35,10 @@ "use strict";

if (/^on/.test(k) && el[k]) {
events[camelCase(k, 'on')] = el[k];
events[camelCase(k, "on")] = el[k];
}
if (k === 'className') {
if (k === "className" && el[k]) {
props[k] = el[k];
}
if (k === "src") {
if (k === "src" && el[k]) {
props[k] = el[k];

@@ -61,8 +61,12 @@ }

if (el.childElementCount) {
children.push(_react["default"].createElement.apply(_react["default"], [el.tagName.toLowerCase(), props === {} ? null : props].concat(_toConsumableArray(getChildren(el.children)))));
} else if (el.tagName.toLowerCase() === 'img') {
children.push(_react["default"].createElement(el.tagName.toLowerCase(), props === {} ? null : props));
} else if (el.textContent) {
children.push(_react["default"].createElement(el.tagName.toLowerCase(), props === {} ? null : props, el.textContent));
if (el.childNodes.length) {
children.push(_react["default"].createElement.apply(_react["default"], [el.tagName.toLowerCase(), props === {} ? null : props].concat(_toConsumableArray(getChildren(el.childNodes)))));
} else {
if (el.nodeType === 3) {
children.push(el.textContent);
} else if (el.nodeType === 1) {
if (["VIDEO", "IMG", "AUDIO"].includes(el.nodeName)) {
children.push(_react["default"].createElement(el.tagName.toLowerCase(), props === {} ? null : props));
}
}
}

@@ -79,5 +83,5 @@ }

return _react["default"].createElement.apply(_react["default"], [domElement.tagName.toLowerCase(), props === {} ? null : props].concat(_toConsumableArray(getChildren(domElement.children))));
return _react["default"].createElement.apply(_react["default"], [domElement.tagName.toLowerCase(), props === {} ? null : props].concat(_toConsumableArray(getChildren(domElement.childNodes))));
};
exports.convert = convert;
{
"name": "html-element-to-react",
"version": "0.4.0",
"version": "0.4.1",
"description": "Convert HTML DOM elements to React elements",

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

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