chore: break earlier if index === 0

This commit is contained in:
kolaente 2022-09-29 18:09:35 +02:00
parent 8ce242bb65
commit d58f8b4ba1
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

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