Package Exports
- hast-util-is-element
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hast-util-is-element) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hast-util-is-element

Check if a node is a (certain) HAST element.
Installation
npm:
npm install hast-util-is-element
Usage
var is = require('hast-util-is-element')
is({type: 'text', value: 'foo'}) // => false
is({type: 'element', tagName: 'a'}, 'a') // => true
is({type: 'element', tagName: 'a'}, ['a', 'area']) // => true
API
isElement(node[, tagName|tagNames])
Check if a node is a (certain) HAST element.
When not given a second parameter, asserts if node
is an element,
otherwise asserts node
is an element whose tagName
matches / is
included in the second parameter.
Parameters
node
(*
) — Value to check;tagName
(string
, optional) — Valuenode
stagName
must match;tagNames
(Array.<string>
, optional) — Value includingnode
stagName
.
Returns
boolean
— whether node
passes the test.
Throws
Error
— When the second parameter is given but invalid.
Contribute
See contributing.md
in syntax-tree/hast
for ways to get
started.
This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.