svelte-depot
TypeScript icon, indicating that this package has built-in type declarations

0.9.4 • Public • Published

Depot for Svelte

CI

Repository pattern implementation connected to a writable store.

Install

npm i svelte-depot

Usage

Here is a basic CRUD example:

// src/stores/books.js
import depot from 'svelte-depot'

const books = depot()
const { store, add, save, remove, find } = books

export function createBook(title, author) {
    add({ title, author })
}

export function updateBook(book) {
    save(book)
}

export function deleteBook(book) {
    remove(book)
}

export function findBookByAuthor(author) {
    return find({ author })
}

export default store

Package Sidebar

Install

npm i svelte-depot

Weekly Downloads

3

Version

0.9.4

License

MIT

Unpacked Size

5.3 kB

Total Files

4

Last publish

Collaborators

  • ubermanu