Skip to content

syntax-tree/hast-util-whitespace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

hast-util-whitespace Build Status Coverage Status

Check whether a HAST node is inter-element whitespace.

Installation

npm:

npm install hast-util-whitespace

Usage

Dependencies:

var whitespace = require('hast-util-whitespace');

whitespace({
  type: 'element',
  tagName: 'div',
  children: []
}); //=> false

whitespace({
  type: 'text',
  value: '\t  \n'
}); //=> true

whitespace({
  type: 'text',
  value: '  text\f'
}); //=> false

API

whitespace(node|value)

Parameters
  • node (Node, optional) — Node whose value to check.
  • value (string, optional) — Value to check.
Returns

boolean — Whether the value (of node) is inter-element white-space: consisting of zero or more of space, tab (\t), line feed (\n), carriage return (\r), or form feed (\f).

Contribute

See contribute.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.

License

MIT © Titus Wormer

About

utility to check if a node is inter-element whitespace

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •