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

virtual-element

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virtual-element - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

13

index.js

@@ -46,3 +46,3 @@ /**

if (arguments.length === 2 && (typeof attributes === 'string' || Array.isArray(attributes))) {
children = attributes
children = [ attributes ]
attributes = {}

@@ -53,3 +53,3 @@ }

// This is essentially just the ES6 rest param
if (arguments.length > 2 && children && Array.isArray(arguments[2]) === false) {
if (arguments.length > 2) {
children = slice(arguments, 2)

@@ -61,11 +61,8 @@ }

// passing in a single child, you can skip
// using the array
if (!Array.isArray(children)) {
children = [children]
}
// Flatten nested child arrays. This is how JSX compiles some nodes.
children = flatten(children, 2)
// Filter out any `undefined` elements
children = children.filter(function (i) { return typeof i !== 'undefined' })
// if you pass in a function, it's a `Component` constructor.

@@ -72,0 +69,0 @@ // otherwise it's an element.

{
"name": "virtual-element",
"version": "1.1.2",
"version": "1.2.0",
"repository": "dekujs/virtual-element",

@@ -5,0 +5,0 @@ "description": "Build virtual tree elements",

@@ -77,2 +77,23 @@ /**

it('should allow sparse lists of children', function () {
var node
node = element('div', {}, null, 'a', 'b', null, 'c')
assert(node.children.length, 5)
// even w/o attrs
node = element('div', 'a', null, 'c')
assert(node.children.length, 3)
})
it('should allow nested arrays as children', function () {
var node
node = element('div', {}, null, [ 'a', 'b' ], 'c')
assert(node.children.length, 3)
node = element('div', null, [ 'a', 'b' ], 'c')
assert(node.children.length, 3)
})
it('should not treat undefined as a child', function () {

@@ -94,2 +115,9 @@ var node

it('should not ignore subsequent children when the first is undefined', function () {
var node
node = element('div', {}, undefined, 'a')
assert.strictEqual(node.children.length, 1)
})
it('render nodes that work with JSX', function(){

@@ -96,0 +124,0 @@ assert.deepEqual(

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