Files
rspade_system/vendor/spatie/ignition/node_modules/hast-util-whitespace/index.js
root f6fac6c4bc Fix bin/publish: copy docs.dist from project root
Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 02:08:33 +00:00

26 lines
891 B
JavaScript
Executable File

/**
* Check if the given value is *inter-element whitespace*.
*
* @param {unknown} thing
* Thing to check (typically `Node` or `string`).
* @returns {boolean}
* Whether the `value` is inter-element whitespace (`boolean`): consisting of
* zero or more of space, tab (`\t`), line feed (`\n`), carriage return
* (`\r`), or form feed (`\f`).
* If a node is passed it must be a `Text` node, whose `value` field is
* checked.
*/
export function whitespace(thing) {
/** @type {string} */
const value =
// @ts-expect-error looks like a node.
thing && typeof thing === 'object' && thing.type === 'text'
? // @ts-expect-error looks like a text.
thing.value || ''
: thing
// HTML whitespace expression.
// See <https://infra.spec.whatwg.org/#ascii-whitespace>.
return typeof value === 'string' && value.replace(/[ \t\n\f\r]/g, '') === ''
}