Socket
Socket
Sign inDemoInstall

hyperx

Package Overview
Dependencies
1
Maintainers
26
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.5.2 to 2.5.3

10

index.js

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

// handle single top-level array template part
if ((
// hx`${[ ...els ]}`
tree[2].length === 1 ||
// trailing whitespace: hx`${[ ...els ]} `
tree[2].length === 2 && /^\s*$/.test(tree[2][1])
) && Array.isArray(tree[2][0])) {
tree[2] = tree[2][0]
}
if (tree[2].length > 2

@@ -142,0 +152,0 @@ || (tree[2].length === 2 && /\S/.test(tree[2][1]))) {

2

package.json
{
"name": "hyperx",
"version": "2.5.2",
"version": "2.5.3",
"description": "tagged template string virtual dom builder",

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

@@ -7,12 +7,24 @@ var test = require('tape')

function createFragment (nodes) {
return nodes
return { frag: nodes }
}
test('mutliple root, fragments as array', function (t) {
test('multiple root, fragments as array', function (t) {
var list = hx`<li>1</li> <li>2<div>_</div></li>`
t.equal(list.length, 3, '3 elements')
t.equal(vdom.create(list[0]).toString(), '<li>1</li>')
t.equal(list[1], ' ')
t.equal(vdom.create(list[2]).toString(), '<li>2<div>_</div></li>')
t.ok(Array.isArray(list.frag))
t.equal(list.frag.length, 3, '3 elements')
t.equal(vdom.create(list.frag[0]).toString(), '<li>1</li>')
t.equal(list.frag[1], ' ')
t.equal(vdom.create(list.frag[2]).toString(), '<li>2<div>_</div></li>')
t.end()
})
test('multiple root embeds, fragments as array', function (t) {
var list = hx`
${[1,2]}
`
t.ok(Array.isArray(list.frag))
t.deepEqual(list, {
frag: [1, 2]
})
t.end()
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc