Creates a new TodoList instance.
Optional
text: stringOptional todotxt text to parse into todos.
Add a new todo from a single line of text.
The todotxt formatted line to parse.
Optional
parserOptions: ParserOptionsOptional configuration for the parser.
Delete a todo by id.
The unique identifier of the todo to delete.
Edit a todo by id using an updater function.
The unique identifier of the todo to edit.
Function that modifies the todo object.
Edit a todo by providing a todo object with the same ID.
The modified Todo object with the same ID as the todo to replace.
Filter todos based on multiple criteria.
An object containing filter criteria.
Optional
completed?: booleanWhether to include completed todos.
Optional
contexts?: string[]Filter by context names.
Optional
dueAfter?: stringInclude todos due after this date (YYYY-MM-DD).
Optional
dueBefore?: stringInclude todos due before this date (YYYY-MM-DD).
Optional
priority?: stringFilter by priority.
Optional
projects?: string[]Filter by project names.
Array of todos matching all specified criteria.
Get all unique contexts used across all todos.
Array of unique context names.
Get todos that are due within a specified number of days from today.
Number of days from today.
Array of todos due within the specified time period.
Get all unique key names used in key-value pairs across all todos.
Array of unique key names.
Get all unique projects used across all todos.
Array of unique project names.
Get a specific todo by its unique identifier.
The unique identifier of the todo to retrieve.
The matching todo or undefined if not found.
Get a todo by its position in the todo list (zero-based).
The line number (0-based index).
The todo at the specified position or undefined if out of bounds.
Get todos that include a specific context.
The context to search for (without the @ symbol).
Array of todos containing the specified context.
Get todos that match a specific key-value pair.
The key name to match.
The value to match against.
Array of todos matching the key-value pair.
Get todos that include a specific project.
The project to search for (without the + symbol).
Array of todos containing the specified project.
Parse a multiline todotxt text. Each non-empty line is parsed as a separate todo. Throws an error if any todo fails to parse.
The todotxt formatted string to parse.
Optional
parserOptions: ParserOptionsOptional configuration for the parser.
Add multiple todo objects directly to the list.
Array of Todo objects to add to the list.
Sort todos by a given criteria.
The criteria to sort by: "priority", "due", "creation", or "completion".
Convert the todo list back to a string representation. This generates a complete todotxt output with one todo per line.
The string representation of all todos.
A class representing a collection of todo.txt todos. Provides methods for parsing, managing, and querying todos in the todo.txt format.