Spaces:
Paused
Paused
Download node_modules/@reduxjs/toolkit/src/entities/entity_state.ts from Leon4gr45/nova-header-nav: direct link, hf CLI and curl.
- Browser
- Download file 958 Bytes
-
https://huggingface.co/spaces/Leon4gr45/nova-header-nav/resolve/main/node_modules/%40reduxjs/toolkit/src/entities/entity_state.ts
- Command line
-
hf download hf://spaces/Leon4gr45/nova-header-nav/node_modules/@reduxjs/toolkit/src/entities/entity_state.ts
-
curl -L -o entity_state.ts https://huggingface.co/spaces/Leon4gr45/nova-header-nav/resolve/main/node_modules/%40reduxjs/toolkit/src/entities/entity_state.ts
958 Bytes
| import type { | |
| EntityId, | |
| EntityState, | |
| EntityStateAdapter, | |
| EntityStateFactory, | |
| } from './models' | |
| export function getInitialEntityState<T, Id extends EntityId>(): EntityState< | |
| T, | |
| Id | |
| > { | |
| return { | |
| ids: [], | |
| entities: {} as Record<Id, T>, | |
| } | |
| } | |
| export function createInitialStateFactory<T, Id extends EntityId>( | |
| stateAdapter: EntityStateAdapter<T, Id>, | |
| ): EntityStateFactory<T, Id> { | |
| function getInitialState( | |
| state?: undefined, | |
| entities?: readonly T[] | Record<Id, T>, | |
| ): EntityState<T, Id> | |
| function getInitialState<S extends object>( | |
| additionalState: S, | |
| entities?: readonly T[] | Record<Id, T>, | |
| ): EntityState<T, Id> & S | |
| function getInitialState( | |
| additionalState: any = {}, | |
| entities?: readonly T[] | Record<Id, T>, | |
| ): any { | |
| const state = Object.assign(getInitialEntityState(), additionalState) | |
| return entities ? stateAdapter.setAll(state, entities) : state | |
| } | |
| return { getInitialState } | |
| } | |