Socket
Socket
Sign inDemoInstall

araz

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

araz - npm Package Compare versions

Comparing version 2.1.7 to 2.1.8

2

package.json
{
"name": "araz",
"version": "2.1.7",
"version": "2.1.8",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.ts",

@@ -14,3 +14,3 @@ import {

} from "lodash-es";
import { VNode } from "./types";
import { Children, VNode } from "./types";

@@ -45,3 +45,3 @@ /**

export const render = async (
nodes: VNode[] | VNode
nodes: Children
): Promise<DocumentFragment | HTMLElement> => {

@@ -53,51 +53,55 @@ const fragment = document.createDocumentFragment();

for (const node of nodeArray) {
const { $tag, $attrs = {}, $children = [] } = node;
if (isString(node)) {
fragment.appendChild(document.createTextNode(node));
} else {
const { $tag, $attrs = {}, $children = [] } = node;
if (!$tag) {
continue;
}
if (!$tag) {
continue;
}
const $el = document.createElement($tag);
const $el = document.createElement($tag);
for (const [key, value] of entries($attrs)) {
if (isEqual(key, "style") && isObject(value)) {
const result = map(
entries(value),
([property, propertyValue]) =>
`${kebabCase(property)}:${propertyValue}`
);
const styleString = join(result, "; ");
$el.setAttribute("style", styleString);
} else if (isEqual(key, "class") && isArray(value)) {
const classList = value.join(" ");
$el.setAttribute("class", trim(classList));
} else if (isEqual(key, "events") && isObject(value)) {
for (const [eventName, eventHandler] of entries(value)) {
const formattedEventName = camelCase(eventName.slice(2));
if (isFunction(eventHandler)) {
$el.addEventListener(
formattedEventName,
eventHandler as unknown as EventListener
);
for (const [key, value] of entries($attrs)) {
if (isEqual(key, "style") && isObject(value)) {
const result = map(
entries(value),
([property, propertyValue]) =>
`${kebabCase(property)}:${propertyValue}`
);
const styleString = join(result, "; ");
$el.setAttribute("style", styleString);
} else if (isEqual(key, "class") && isArray(value)) {
const classList = value.join(" ");
$el.setAttribute("class", trim(classList));
} else if (isEqual(key, "events") && isObject(value)) {
for (const [eventName, eventHandler] of entries(value)) {
const formattedEventName = camelCase(eventName.slice(2));
if (isFunction(eventHandler)) {
$el.addEventListener(
formattedEventName,
eventHandler as unknown as EventListener
);
}
}
} else {
$el.setAttribute(key, isString(value) ? value.toString() : "");
}
} else {
$el.setAttribute(key, isString(value) ? value.toString() : "");
}
}
if (isString($children)) {
$el.appendChild(document.createTextNode($children));
} else if (Array.isArray($children)) {
for (const child of $children) {
if (isString(child)) {
$el.appendChild(document.createTextNode(child));
} else {
const $child = await render(child);
$el.appendChild($child);
if (isString($children)) {
$el.appendChild(document.createTextNode($children));
} else if (Array.isArray($children)) {
for (const child of $children) {
if (isString(child)) {
$el.appendChild(document.createTextNode(child));
} else {
const $child = await render(child);
$el.appendChild($child);
}
}
}
fragment.appendChild($el);
}
fragment.appendChild($el);
}

@@ -104,0 +108,0 @@

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