Socket
Socket
Sign inDemoInstall

hyperx

Package Overview
Dependencies
Maintainers
26
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperx - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

test/fragments.js

23

example/react.js
var React = require('react')
var toString = require('react-dom/server').renderToString
var hyperx = require('../')
var hx = hyperx(React.createElement)
// hyperx always uses a children array, but react needs children as separate arguments,
// so spread them using this wrapper
function createElement (tag, props, children) {
return React.createElement.apply(null, [tag, props].concat(children))
}
function createFragment (children) {
return createElement(React.Fragment, {}, children)
}
var hx = hyperx(createElement, {
createFragment: createFragment
})
var title = 'world'
var wow = [1,2,3]
var frag = hx`
<tr> <td>row1</td> </tr>
<tr> <td>row2</td> </tr>
`
var tree = hx`<div>

@@ -13,5 +30,7 @@ <h1 y="ab${1+2}cd">hello ${title}!</h1>

${wow.map(function (w, i) {
return hx`<b>${w}</b>\n`
return hx`<b key="${i}">${w}</b>\n`
})}
<table>${frag}</table>
</div>`
console.log(toString(tree))

4

index.js

@@ -140,2 +140,3 @@ var attrToProp = require('hyperscript-attribute-to-property')

|| (tree[2].length === 2 && /\S/.test(tree[2][1]))) {
if (opts.createFragment) return opts.createFragment(tree[2])
throw new Error(

@@ -276,5 +277,2 @@ 'multiple root elements must be wrapped in an enclosing tag'

var hasOwn = Object.prototype.hasOwnProperty
function has (obj, key) { return hasOwn.call(obj, key) }
var closeRE = RegExp('^(' + [

@@ -281,0 +279,0 @@ 'area', 'base', 'basefont', 'bgsound', 'br', 'col', 'command', 'embed',

{
"name": "hyperx",
"version": "2.4.0",
"version": "2.5.0",
"description": "tagged template string virtual dom builder",

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

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