MCPcopy Create free account
hub / github.com/ngrx/platform / createFeatureSelector

Function createFeatureSelector

modules/store/src/selector.ts:710–731  ·  view source on GitHub ↗
(
  featureName: any
)

Source from the content-addressed store, hash-verified

708 featureName: keyof T
709): MemoizedSelector<T, V>;
710export function createFeatureSelector(
711 featureName: any
712): MemoizedSelector<any, any> {
713 return createSelector(
714 (state: any) => {
715 const featureState = state[featureName];
716 if (!isNgrxMockEnvironment() && isDevMode() && !(featureName in state)) {
717 console.warn(
718 `@ngrx/store: The feature name "${featureName}" does ` +
719 'not exist in the state, therefore createFeatureSelector ' +
720 'cannot access it. Be sure it is imported in a loaded module ' +
721 `using StoreModule.forRoot('${featureName}', ...) or ` +
722 `StoreModule.forFeature('${featureName}', ...). If the default ` +
723 'state is intended to be undefined, as is the case with router ' +
724 'state, this development-only warning message can be ignored.'
725 );
726 }
727 return featureState;
728 },
729 (featureState: any) => featureState
730 );
731}
732
733function isSelectorsDictionary(
734 selectors: unknown

Callers 15

createRouterSelectorFunction · 0.90
createFeatureFunction · 0.90
mock_store.spec.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
books.selectors.tsFile · 0.90
index.tsFile · 0.90
books.selectors.tsFile · 0.90

Calls 3

isNgrxMockEnvironmentFunction · 0.90
createSelectorFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected