eslint-plugin-svelte
Version:
ESLint plugin for Svelte using AST
17 lines (16 loc) • 527 B
JavaScript
/**
* Check whether the given token is a whitespace.
*/
export function isWhitespace(token) {
return (token != null &&
((token.type === 'HTMLText' && !token.value.trim()) ||
(token.type === 'JSXText' && !token.value.trim())));
}
/**
* Check whether the given token is a not whitespace.
*/
export function isNotWhitespace(token) {
return (token != null &&
(token.type !== 'HTMLText' || Boolean(token.value.trim())) &&
(token.type !== 'JSXText' || Boolean(token.value.trim())));
}