Delete

Pesudocode

deleteNote(id, metaOnly) {
    noteToDelete := id
    if (!metaOnly) fs.unlink(noteToDelete)
    if (noteToDelete.children {
        noteToDelete.stub = true
        @updateNote(noteToDelete)
    } else {
        parentNote := noteToDelete
        parentNote.children.reject! noteToDelete
        @notes.delete! noteToDelete
        while parentNote.stub {
            @deleteNote parentNote
        }
    }

}


Backlinks