hast utility to assert trees.
npm:
npm install hast-util-assert
var assert = require('hast-util-assert')
assert({type: 'root', children: []})
assert({type: 'element', tagName: 'a', properties: {}, children: []})
// All OK.
assert({children: []})
// AssertionError: node should have a type: `{ children: [] }`
assert({type: 'element', properties: {}, children: []})
// AssertionError: `element` should have a `tagName`: `{ type: 'element', properties: {}, children: [] }`
Assert that the given tree
is a valid hast tree.
If tree
is a parent, all children will be asserted as
well.
The assert.parent
, assert.text
, assert.void
, and assert.wrap
methods from unist-util-assert
are also included.
See contributing.md
in syntax-tree/.github
for ways to get
started.
See support.md
for ways to get help.
This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.