Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

todo-memory-store

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

todo-memory-store

This implements a basic in-memory store for building demo Todo list apps for bicycle. It includes two default todos so you don't have to start with the empty state.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

todo-memory-store

This implements a basic in-memory store for building demo Todo list apps for bicycle. It includes two default todos so you don't have to start with the empty state.

Installation

yarn add todo-memory-store

Types

interface Todo {
  id: string;
  title: string;
  completed: boolean;
}
interface TodoInput {
  title: string;
  completed: boolean;
}

API

import * as store from 'todo-memory-store';
  • store.addTodo(todo: TodoInput): Promise<void>
  • store.toggleAll(checked: boolean): Promise<void>
  • store.toggle(id: string, checked: boolean): Promie<void>
  • store.destroy(id: string): Promie<void>
  • store.setTitle(id: string, title: string): Promie<void>
  • store.clearCompleted(): Promie<void>
  • store.getTodos(): Promise<Array<Todo>>
  • store.getTodo(id: string): Promise<Todo | null>

Testing

The following methods are exposed for use in tests:

  • store.getTodosSync() - get the TODO entries in the store synchronously
  • store.reset() - reset to the two default TODO entries
  • store.setLatency(latencyMilliseconds: number) - change the artificial latency, defaults to 200ms
  • store.enableDeterminsticIDs() - make the UUIDs generated for newly created TODOs deterministic, rather than random
  • store.disbaleDeterminsticIDs() - undo enableDeterminsticIDs
  • uuid - generate a uuid, or get the next deterministic id

FAQs

Package last updated on 06 Feb 2019

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