indexed_collection_helpers.svelte.ts

Declarations
#

10 declarations

view source

create_derived_index
#

indexed_collection_helpers.svelte.ts view source

<T extends IndexedItem, TResult extends Array<T> = T[]>(options: DerivedIndexOptions<T, TResult>): IndexDefinition<T, TResult, void>

Create an incremental derived collection index.

options

type DerivedIndexOptions<T, TResult>

returns

IndexDefinition<T, TResult, void>

create_dynamic_index
#

indexed_collection_helpers.svelte.ts view source

<T extends IndexedItem, F extends (...args: Array<any>) => any>(options: DynamicIndexOptions<T, F>): IndexDefinition<T, F, Parameters<F>[0]>

Create a dynamic index that computes results on-demand based on query parameters.

options

type DynamicIndexOptions<T, F>

returns

IndexDefinition<T, F, Parameters<F>[0]>

create_multi_index
#

indexed_collection_helpers.svelte.ts view source

<T extends IndexedItem, K>(options: MultiIndexOptions<T, K>): IndexDefinition<T, SvelteMap<K, T[]>, K>

Create a multi-value index (one key maps to many items).

options

type MultiIndexOptions<T, K>

returns

IndexDefinition<T, SvelteMap<K, T[]>, K>

create_single_index
#

indexed_collection_helpers.svelte.ts view source

<T extends IndexedItem, K>(options: SingleIndexOptions<T, K>): IndexDefinition<T, SvelteMap<K, T>, K>

Create a single-value index (one key maps to one item).

options

type SingleIndexOptions<T, K>

returns

IndexDefinition<T, SvelteMap<K, T>, K>

DerivedIndexOptions
#

indexed_collection_helpers.svelte.ts view source

DerivedIndexOptions<T, TResult>

Options for derived indexes.

generics

T

constraint IndexedItem

TResult

constraint Array<T>
default Array<T>

inheritance

extends:
  • IndexOptions<T, void>

compute

Function that computes the derived collection from the full collection.

type (collection: IndexedCollection<T>) => TResult

sort

Optional sort function for the derived array.

type (a: T, b: T) => number

onadd

Optional custom add handler.

type (items: TResult, item: T, collection: IndexedCollection<T>) => TResult

onremove

Optional custom remove handler.

type (items: TResult, item: T, collection: IndexedCollection<T>) => TResult

DynamicIndexOptions
#

indexed_collection_helpers.svelte.ts view source

DynamicIndexOptions<T, F>

Options for dynamic indexes.

generics

T

constraint IndexedItem

F

constraint (...args: Array<any>) => any

inheritance

extends:
  • IndexOptions<T, Parameters<F>[0]>

factory

Function that creates a query function from the collection

type (collection: IndexedCollection<T>) => F

onadd

Optional custom add handler

type (fn: F, item: T, collection: IndexedCollection<T>) => F

onremove

Optional custom remove handler

type (fn: F, item: T, collection: IndexedCollection<T>) => F

IndexedItem
#

IndexOptions
#

indexed_collection_helpers.svelte.ts view source

IndexOptions<T, TQuery>

Common options interface for all index types.

generics

T

constraint IndexedItem

TQuery

default any

key

Unique key for this index.

type string

matches

Optional predicate to determine if an item is relevant to this index.

type (item: T) => boolean

query_schema

Schema for query input validation and typing.

type z.ZodType<TQuery>

MultiIndexOptions
#

indexed_collection_helpers.svelte.ts view source

MultiIndexOptions<T, K>

Options for multi-value indexes.

generics

T

constraint IndexedItem

K

inheritance

extends:
  • IndexOptions<T, K>

extractor

Function that extracts the key(s) from an item.

type (item: T) => K | Array<K> | undefined

sort

Optional sort function for items in each bucket.

type (a: T, b: T) => number

SingleIndexOptions
#

Depends on
#

Imported by
#