mdast-util-assert
mdast utility to assert trees
Last updated 7 months ago by wooorm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mdast-util-assert 
SYNC missed versions from official npm registry.

mdast-util-assert

Build Coverage Downloads Size Sponsors Backers Chat

mdast utility to assert trees.

Install

npm:

npm install mdast-util-assert

Use

var assert = require('mdast-util-assert')

assert({type: 'root', children: []})
assert({type: 'break'})
assert({type: 'listItem', checked: true, children: []})
// All OK.

assert({children: []})
// AssertionError: node should have a type: `{ children: [] }`

assert({type: 'paragraph', value: 'foo'})
// AssertionError: parent should have children: `{ type: 'paragraph', value: 'foo' }`

API

assert(node)

Assert that tree is a valid mdast node. 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.

Security

Use of mdast-util-assert does not involve hast so there are no openings for cross-site scripting (XSS) attacks.

Contribute

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, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Current Tags

  • 3.0.0                                ...           latest (7 months ago)

6 Versions

  • 3.0.0                                ...           7 months ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 0
This Week 32
This Month 34
Last Day 18
Last Week 2
Last Month 16
Dependencies (4)
Dev Dependencies (8)

Copyright 2014 - 2016 © taobao.org |