Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

utility to check if a node is inter-element whitespace

License

NotificationsYou must be signed in to change notification settings

syntax-tree/hast-util-whitespace

BuildCoverageDownloadsSizeSponsorsBackersChat

hast utility to check if a node isinter-element whitespace.

Contents

What is this?

This package is a small utility that checks if a node is whitespace according toHTML.

When should I use this?

This utility is super niche, if you’re here you probably know what you’relooking for!

Install

This package isESM only.In Node.js (version 16+), install withnpm:

npm install hast-util-whitespace

In Deno withesm.sh:

import{whitespace}from'https://esm.sh/hast-util-whitespace@3'

In browsers withesm.sh:

<scripttype="module">import{whitespace}from'https://esm.sh/hast-util-whitespace@3?bundle'</script>

Use

import{whitespace}from'hast-util-whitespace'whitespace({type:'element',tagName:'div',properties:{},children:[]})// => falsewhitespace({type:'text',value:'\t  \n'})// => truewhitespace({type:'text',value:'  text\f'})// => false

API

This package exports the identifierwhitespace.There is no default export.

whitespace(thing)

Check if the given value isinter-element whitespace.

Parameters
  • thing (Node orstring, optional)— thing to check
Returns

Whether thevalue is inter-element whitespace (boolean): consisting of zeroor more of space, tab (\t), line feed (\n), carriage return (\r), or formfeed (\f).If a node is passed it must be aText node, whosevalue field ischecked.

Types

This package is fully typed withTypeScript.It exports no additional types.

Compatibility

Projects maintained by the unified collective are compatible with maintainedversions of Node.js.

When we cut a new major release, we drop support for unmaintained versions ofNode.This means we try to keep the current release line,hast-util-whitespace@^3,compatible with Node.js 16.

Security

hast-util-whitespace does not change the syntax tree so there are no openingsforcross-site scripting (XSS) attacks.

Related

Contribute

Seecontributing.md insyntax-tree/.github forways to get started.Seesupport.md for ways to get help.

This project has acode of conduct.By interacting with this repository, organization, or community you agree toabide 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

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp