Skip to content

Commit

Permalink
🍱 New script to remove empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
chsxf committed Dec 31, 2021
1 parent 2c30ad5 commit c85dc4c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Scripts/RemoveEmptyLines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
{
"api":1,
"name":"Remove Empty Lines",
"description":"Removes empty lines.",
"author":"chsxf (https://chsxf.dev)",
"icon":"broom",
"tags":"clean,remove,empty,lines"
}
**/

function main(input) {
try {
let lines = input.text.split("\n")
var result = []
for (let line of lines) {
let trimmed = line.trim();
if (trimmed.length > 0) {
result.push(line);
}
}
input.text = result.join("\n");
}
catch(error) {
state.postError("Something strange happened here...")
}
}

0 comments on commit c85dc4c

Please sign in to comment.