jstodotxt
    Preparing search index...

    Class Item

    Represents a single line in a todo.txt file.

    Index
    • Add a new context to the task. Will append to the end. If the context is already present, it will not be added.

      Parameters

      • tag: string

        A valid context, without the @

      Returns void

    • Parameters

      • key: string
      • value: string

      Returns void

    • Add a new project to the task. Will append to the end. If the project is already present, it will not be added.

      Parameters

      • tag: string

        A valid project, without the +

      Returns void

    • Get the body of the task.

      Returns string

      The body portion of the task.

    • Remove the completed date from the task.

      Returns void

    • Remove the created date from the task.

      Side Effect

      Clearing the created date will also unset the completed date.

      Returns void

    • Remove the priority from this task.

      Returns void

    • Is this task complete?

      Returns boolean

    • Get the completed date of this task.

      Returns Date | null

      The completed date, or null if not set.

    • Get the completed date as string, or an empty string if not set.

      Returns string

      The completed date as a string formatted for todo.txt (YYYY-MM-DD)

    • Get all of the context tags on the task.

      Returns string[]

      Context tags, without the @

    • Get the creation date of this task.

      Returns Date | null

      The creation date, or null if not set.

    • Get the creation date as string, or an empty string if not set.

      Returns string

      The creation date as a string formatted for todo.txt (YYYY-MM-DD)

    • Get all of the project tags on the task.

      Returns { key: string; value: string }[]

      Project tags, without the +

    • Parse in a full todo.txt line, replacing and resetting all fields.

      Parameters

      • line: string

        A full todo.txt task line

      Returns void

    • Get the priority of this Item, or null if not present.

      Returns string | null

    • Get all of the project tags on the task.

      Returns string[]

      Project tags, without the +

    • Remove a context from the task, if present.

      Parameters

      • tag: string

        A valid context, without the @

      Returns void

    • Parameters

      • key: string
      • value: string | null = null

      Returns void

    • Remove a project from the task, if present.

      Parameters

      • tag: string

        A valid project, without the +

      Returns void

    • Parse and set the body and body elements.

      Side Effect

      This will clear and re-load contexts, projects and extensions.

      Parameters

      • body: string

        A todo.txt description string.

      Returns void

    • Set if this task is complete.

      Side Effect

      Setting this to false will clear the completed date.

      Parameters

      • complete: boolean

        True if the task is complete.

      Returns void

    • Set the completed date for the task. Passing null or no argument clears the completed date.

      Side Effect

      Setting completed will set complete to true.

      Parameters

      • date: string | Date | null = null

      Returns void

      An Error when the date is provided as a string and is invalid.

    • Set the created date for the task. Passing null or no argument clears the created date.

      Side Effect

      Clearing the created date will also unset the completed date.

      Parameters

      • date: string | Date | null = null

      Returns void

      An Error when the date is provided as a string and is invalid.

    • Parameters

      • key: string
      • value: string

      Returns void

    • Set the priority of the task. Passing null or no argument clears priority.

      Parameters

      • priority: Priority = null

        A priority from A-Z or null to clear priority.

      Returns void

      An Error when the input is invalid.

    • Generate the full todo.txt line of this Item, as well as spans describing the location of all of it's component parts.

      Returns AnnotatedItem

    • Generate a full todo.txt line out of this Item.

      Returns string