Nitrogenous Polymorphic Molecule
Wondering what’s next for npm?Check out our public roadmap! »

hast-util-phrasing

1.0.5 • Public • Published

hast-util-phrasing

Build Coverage Downloads Size Sponsors Backers Chat

hast utility to check if a node is phrasing content.

Install

npm:

npm install hast-util-phrasing

Use

var phrasing = require('.')
 
// Given flow content:
phrasing({
  type: 'element',
  tagName: 'div',
  children: [{type: 'text', value: 'Alpha'}]
})
// => false
 
// Given a phrasing element:
phrasing({
  type: 'element',
  tagName: 'meta',
  properties: {itemProp: 'bravo'},
  children: []
})
// => true
 
// Given a non-phrasing element:
phrasing({
  type: 'element',
  tagName: 'meta',
  properties: {charSet: 'utf8'},
  children: []
})
// => false
 
// Given text:
phrasing({type: 'text', value: 'Delta'})
// => true

API

phrasing(node)

Check if the given value is phrasing content.

Parameters
  • node (*) — Value to check, typically Node.
Returns

boolean — Whether node passes the test.

Security

hast-util-phrasing does not change the syntax tree 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

Install

npm i hast-util-phrasing

DownloadsWeekly Downloads

15,255

Version

1.0.5

License

MIT

Unpacked Size

7.44 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar