chore: break earlier if index === 0

This commit is contained in:
kolaente 2022-09-29 18:09:35 +02:00
parent 8ce242bb65
commit d58f8b4ba1
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 1 deletions

View File

@ -20,10 +20,14 @@ export function parseSubtasksViaIndention(taskTitles: string): TaskWithParent[]
parent: null,
}
if (index === 0) {
return task
}
const matched = spaceRegex.exec(title)
const matchedSpaces = matched ? matched[0].length : 0
if (matchedSpaces > 0 && index > 0) {
if (matchedSpaces > 0) {
// Go up the tree to find the first task with less indention than the current one
let pi = 1
let parentSpaces = 0