graycoreio/daffodil

View on GitHub
libs/geography/state/src/reducers/country-entities/country-entities-adapter.ts

Summary

Maintainability
A
0 mins
Test Coverage
import {
  EntityAdapter,
  createEntityAdapter,
} from '@ngrx/entity';

import { DaffCountry } from '@daffodil/geography';

/**
 * Country Adapter for changing/overwriting entity state.
 */
export const getCountryAdapter = (() => {
  let cache;
  return <T extends DaffCountry = DaffCountry>(): EntityAdapter<T> =>
    cache = cache || createEntityAdapter<T>();
})();