@data-client/normalizr
Version:
Normalizes and denormalizes JSON according to schema for Redux and Flux applications
15 lines (13 loc) • 486 B
text/typescript
import { ImmDelegate } from '../delegate/Delegate.imm.js';
import type { EntityPath } from '../interface.js';
import type { DenormGetEntity } from './types.js';
/** Handles ImmutableJS state for MemoCache methods */
export const MemoPolicy = {
QueryDelegate: ImmDelegate,
getEntities(entities: {
getIn(path: [string, string]): unknown;
}): DenormGetEntity {
return ({ key, pk }: EntityPath): symbol | object | undefined =>
entities.getIn([key, pk]) as any;
},
};