Svelte Keyed screenshot

Svelte Keyed

Author Avatar Theme by Bryanmylee
Updated: 2 Jan 2024
71 Stars

A writable derived store for objects and arrays

Categories

Overview

The svelte-keyed package is a writable derived store for objects and arrays. It provides a solution to common limitations in working with Svelte auto-subscriptions, allowing for easier management of object store properties and the extraction of functionality into external helper functions.

Features

  • Writable Derived Store: svelte-keyed provides a writable derived store for objects and arrays, allowing for easy management of store updates.
  • Nullable Parents: If the parent store is nullable, the child store will also be nullable, providing flexibility in handling nullable properties.
  • TypeScript Support: svelte-keyed supports TypeScript, inferring the return type of the keyed store from the keypath. It also tries to guess all possible keypaths up to a depth limit of 3.

Installation

To install svelte-keyed, you can use npm. Since Svelte automatically bundles all required dependencies, you only need to install this package as a dev dependency with the -D flag.

npm install svelte-keyed -D

Summary

svelte-keyed is a package that enhances the functionality of Svelte auto-subscriptions by providing a writable derived store for objects and arrays. It solves common limitations, such as setting store properties into component context and extracting functionality into helper functions. With TypeScript support and nullable parent stores, svelte-keyed offers a comprehensive solution for managing and manipulating Svelte stores.