Options
All
  • Public
  • Public/Protected
  • All
Menu

Module internal/normalize

Index

Type aliases

Functions

Type aliases

Normalized

Normalized<T>: { allIds: ID[]; byId: {} }

Normalized state tracking entities by ID

Type parameters

  • T

Type declaration

  • allIds: ID[]

    List of all entities IDs, sorted in the order they were added

  • byId: {}

    Map of entities by ID. EntityStore supports string and number ID types

    • [id: string]: T

Functions

Const normalize

  • Takes a list of elements and normalizes them by ID

    Type parameters

    • T

      Entity type being stored

    Parameters

    • getID: GetID<T>

      Function that returns the ID of an entity

    Returns (items: T[]) => Normalized<T>

    Noramlized state holding the given items

Generated using TypeDoc