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

Function getCreateEffectMetadata

modules/effects/src/effect_creator.ts:128–158  ·  view source on GitHub ↗
(
  instance: T
)

Source from the content-addressed store, hash-verified

126}
127
128export function getCreateEffectMetadata<T extends Record<keyof T, Object>>(
129 instance: T
130): EffectMetadata<T>[] {
131 const propertyNames = Object.getOwnPropertyNames(instance) as Array<keyof T>;
132
133 const metadata: EffectMetadata<T>[] = propertyNames
134 .filter((propertyName) => {
135 if (
136 instance[propertyName] &&
137 instance[propertyName].hasOwnProperty(CREATE_EFFECT_METADATA_KEY)
138 ) {
139 // If the property type has overridden `hasOwnProperty` we need to ensure
140 // that the metadata is valid (containing a `dispatch` property)
141 // https://github.com/ngrx/platform/issues/2975
142 const property = instance[propertyName] as any;
143 return property[CREATE_EFFECT_METADATA_KEY].hasOwnProperty('dispatch');
144 }
145 return false;
146 })
147 .map((propertyName) => {
148 const metaData = (instance[propertyName] as any)[
149 CREATE_EFFECT_METADATA_KEY
150 ];
151 return {
152 propertyName,
153 ...metaData,
154 };
155 });
156
157 return metadata;
158}

Callers 2

getSourceMetadataFunction · 0.90

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected