remove_surrounding_whitespace_nodes() — svelte Function Reference
Architecture documentation for the remove_surrounding_whitespace_nodes() function in legacy.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 59927267_2eb1_7776_901d_f15eb7398b08["remove_surrounding_whitespace_nodes()"] 21beed52_94ea_f810_11b8_87a2cf50432f["legacy.js"] 59927267_2eb1_7776_901d_f15eb7398b08 -->|defined in| 21beed52_94ea_f810_11b8_87a2cf50432f 739544c3_ed59_a35e_6bea_b1b4d2b50e81["convert()"] 739544c3_ed59_a35e_6bea_b1b4d2b50e81 -->|calls| 59927267_2eb1_7776_901d_f15eb7398b08 style 59927267_2eb1_7776_901d_f15eb7398b08 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/legacy.js lines 16–34
function remove_surrounding_whitespace_nodes(nodes) {
const first = nodes.at(0);
const last = nodes.at(-1);
if (first?.type === 'Text') {
if (!regex_not_whitespace.test(first.data)) {
nodes.shift();
} else {
first.data = first.data.replace(regex_starts_with_whitespaces, '');
}
}
if (last?.type === 'Text') {
if (!regex_not_whitespace.test(last.data)) {
nodes.pop();
} else {
last.data = last.data.replace(regex_ends_with_whitespaces, '');
}
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does remove_surrounding_whitespace_nodes() do?
remove_surrounding_whitespace_nodes() is a function in the svelte codebase, defined in packages/svelte/src/compiler/legacy.js.
Where is remove_surrounding_whitespace_nodes() defined?
remove_surrounding_whitespace_nodes() is defined in packages/svelte/src/compiler/legacy.js at line 16.
What calls remove_surrounding_whitespace_nodes()?
remove_surrounding_whitespace_nodes() is called by 1 function(s): convert.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free