chore: break earlier if index === 0
This commit is contained in:
parent
8ce242bb65
commit
d58f8b4ba1
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue