feat(els): implement extract into function

This commit is contained in:
Shunsuke Shibayama 2023-05-28 14:14:27 +09:00
parent b8b312caad
commit bb1dd5eb8e
4 changed files with 83 additions and 15 deletions

View file

@ -189,3 +189,16 @@ pub fn trim_eliminate_top_indent(code: String) -> String {
}
result
}
pub fn deepen_indent(code: String) -> String {
let mut result = String::new();
for line in code.lines() {
result.push_str(" ");
result.push_str(line);
result.push('\n');
}
if !result.is_empty() {
result.pop();
}
result
}