Skip to main content

existsProject()

Description

Checks whether the specified project exists in DataStore

Usage

existsProject({ id: string | number }): boolean;

Parameters

  • id - (required) the ID of the project

Returns

The method returns true if the project exists; otherwise, false

Example

const { ToDo, Toolbar } = todo;

const list = new ToDo("#root", {
projects: [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
]
});

const toolbar = new Toolbar("#toolbar", {
api: list.api,
});

// check whether projects exist
list.existsProject({ id: 1 }); // -> false
list.existsProject({ id: "first" }); // -> true

Related article: Project object