Socket
Book a DemoInstallSign in
Socket

todolibformobileapp

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

todolibformobileapp

A comprehensive ToDo library for managing categories and tasks with priority, recurring schedules, and automatic cleanup

1.0.8
latest
Source
npmnpm
Version published
Weekly downloads
593
Maintainers
1
Weekly downloads
 
Created
Source

ToDoLib

A comprehensive JavaScript library for managing todo categories and tasks with advanced features like priority management, recurring schedules, and automatic cleanup.

Features

  • Category Management: Create, update, delete, and prioritize categories
  • Task Management: Add, update, delete, and prioritize tasks within categories
  • Priority System: Automatic priority management for both categories and tasks
  • Recurring Tasks: Support for repeatable tasks with flexible scheduling
  • Automatic Cleanup: Clean up completed non-repeatable tasks and empty categories
  • Data Sorting: Built-in sorting functionality for organized data
  • Immutable Operations: All operations return new data without mutating the original

Installation

npm install todolibformobileapp

Quick Start

// ES6 Modules
import ToDoLib from "todolibformobileapp";
// or import specific functions
import { addCategory, addTask, sortToDos } from "todolibformobileapp";

// Create a new category
let data = [];
data = ToDoLib.addCategory(data, "cat_001", "Work", "#FF5733");

// Add a task to the category
data = ToDoLib.addTask(data, "cat_001", {
  name: "Complete project",
  notes: "Finish the final implementation",
  canBeRepeated: false,
});

// Sort the data
data = ToDoLib.sortToDos(data);

API Reference

Category Operations

addCategory(data, _id, name, color)

Adds a new category to the data.

  • data: Array of category objects
  • _id: Unique identifier for the category
  • name: Category name
  • color: Category color (hex code)

deleteCategoryById(data, _id)

Deletes a category by its ID.

updateCategoryPriority(data, _id, newPriority)

Updates the priority of a category.

toggleCategoryDone(data, _id, status?)

Toggles the done status of a category and all its tasks.

Task Operations

addTask(data, _id, taskDetails)

Adds a task to a specific category.

const taskDetails = {
  name: "Task name",
  notes: "Task description",
  canBeRepeated: true,
  when: "Monday,Wednesday,Friday",
};

addOrUpdateTask(data, _id, name, notes?, canBeRepeated?, when?)

Adds a new task or updates an existing one.

updateTask(data, _id, taskName, updateDetails)

Updates an existing task's properties.

deleteTask(data, _id, name)

Deletes a task from a category.

updateTaskPriority(data, _id, name, newPriority)

Updates the priority of a specific task.

toggleTaskDone(data, _id, name, status)

Toggles the done status of a task.

Utility Functions

sortToDos(data)

Sorts categories and tasks by priority.

getModifiedCategories(data)

Returns categories that have been modified.

chron(data)

Processes recurring tasks and cleans up completed tasks.

Returns an object with:

  • update: Modified categories
  • delete: Array of deleted category IDs

Data Structure

Category Object

{
  _id: "cat_001",
  name: "Work",
  color: "#FF5733",
  priority: 1,
  done: 2,
  notDone: 3,
  total: 5,
  isMarkedDone: false,
  tasks: [...]
}

Task Object

{
  name: "Complete project",
  notes: "Finish the implementation",
  priority: 1,
  done: false,
  canBeRepeated: true,
  when: "Monday,Wednesday,Friday"
}

Recurring Tasks

The library supports flexible recurring task scheduling:

  • Days of week: "Monday,Wednesday,Friday"
  • Specific dates: "2025-08-22"
  • Date numbers: "15" (15th of each month)

Use the chron() function to process recurring tasks automatically.

License

MIT

Contributing

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

Support

For issues and questions, please use the GitHub Issues page.

Keywords

todo

FAQs

Package last updated on 22 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.