Skip to content

Commit

Permalink
refactor: use core provider API from module API (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 authored Oct 2, 2024
1 parent cbf54bc commit c1212b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 2 additions & 3 deletions projects/ngx-meta/src/core/src/providers/core-feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ export const isCoreFeature = (
*/
export type CoreFeatures = ReadonlyArray<CoreFeature<CoreFeatureKind>>

export const providersFromCoreFeatures = (
features: CoreFeatures,
): ReadonlyArray<Provider> => features.map((f) => f._providers)
export const providersFromCoreFeatures = (features: CoreFeatures): Provider[] =>
features.map((f) => f._providers)
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
CoreFeatureKind,
CoreFeatures,
isCoreFeature,
providersFromCoreFeatures,
} from './core-feature'
import { provideNgxMetaCore } from './provide-ngx-meta-core'

/**
* Provides `ngx-meta`'s core library services.
Expand Down Expand Up @@ -84,10 +84,7 @@ export class NgxMetaCoreModule {
return {
ngModule: NgxMetaCoreModule,
providers: [
...providersFromCoreFeatures([
...optionFeaturesOrFirstFeature,
...features,
]),
provideNgxMetaCore(...optionFeaturesOrFirstFeature, ...features),
],
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ import { CoreFeatures, providersFromCoreFeatures } from './core-feature'
export const provideNgxMetaCore = (
...features: CoreFeatures
): EnvironmentProviders =>
makeEnvironmentProviders([...providersFromCoreFeatures(features)])
makeEnvironmentProviders(providersFromCoreFeatures(features))

0 comments on commit c1212b7

Please sign in to comment.