Socket
Socket
Sign inDemoInstall

mithril-node-render

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mithril-node-render - npm Package Compare versions

Comparing version 1.0.1-5 to 1.0.1-6

52

index.js

@@ -10,2 +10,4 @@ 'use strict'

const COMPONENT_PROPS = ['oninit', 'view', 'oncreate', 'onbeforeupdate', 'onupdate', 'onbeforeremove', 'onremove']
function isArray (thing) {

@@ -28,11 +30,8 @@ return thing !== '[object Array]' && Object.prototype.toString.call(thing) === '[object Array]'

// Lifted from the Mithril rewrite
function copy (source) {
var res = source
if (isArray(source)) {
res = Array(source.length)
for (var i = 0; i < source.length; i++) res[i] = source[i]
} else if (typeof source === 'object') {
res = {}
for (var k in source) res[k] = source[k]
function omit (source, keys = []) {
var res = {}
for (var k in source) {
if (keys.indexOf(k) < 0) {
res[k] = source[k]
}
}

@@ -42,2 +41,4 @@ return res

const copy = omit
// shameless stolen from https://github.com/punkave/sanitize-html

@@ -163,19 +164,2 @@ function escapeHtml (s, replaceDoubleQuote) {

var component, vnode
if (isObject(view.tag)) { // embedded component
component = view.tag
vnode = {
state: copy(component),
children: copy(view.children),
attrs: view.attrs || {}
}
} else if (view.view) { // root component
component = view
vnode = {
state: copy(component),
children: copy(view.children),
attrs: options.attrs || {}
}
}
if (view.attrs) {

@@ -186,10 +170,12 @@ yield setHooks(view.attrs, view, hooks)

// component
if (isObject(view.tag)) {
vnode = {
state: copy(view.tag),
children: copy(view.children),
attrs: view.attrs
if (view.view || isObject(view.tag)) {
var component = view.view || view.tag
var vnode = {
tag: copy(component),
state: omit(component, COMPONENT_PROPS),
children: [].concat(view.children),
attrs: component.attrs || view.attrs || {}
}
yield setHooks(view.tag, vnode, hooks)
return yield _render(view.tag.view.call(vnode.state, vnode), options, hooks)
yield setHooks(component, vnode, hooks)
return yield _render(component.view.call(vnode.state, vnode), options, hooks)
}

@@ -196,0 +182,0 @@

{
"name": "mithril-node-render",
"version": "1.0.1-5",
"version": "1.0.1-6",
"description": "Node rending of mithril views",

@@ -5,0 +5,0 @@ "main": "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