deku-component-is-node

1.0.0 • Public • Published

deku-component-is-node Build Status

Determine if an object is a valid Deku node. Useful for testing.

Example

import isNode from 'deku-component-is-node'
import element from 'virtual-element'
import Mock from 'component-mock'
 
const Component = {
  render: function () {
    element('div', [
      element('span', 'Hello World!')
    ])
  }
}
 
const mock = Mock(component)
const node = mock.render()
 
isNode(node) //=> returns `true`
isNode(node, 'div') //=> returns `true`
isNode(node, 'span') //=> returns `false`

API

isNode(node, [type])

Returns true if node is a valid Deku node. If type is specified, it will ensure that type is strictly equal. (whether that is a Component or a String element name)

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i deku-component-is-node

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kvnneff