MCPcopy
hub / github.com/nestjs/nest / replace

Method replace

packages/core/injector/module.ts:537–550  ·  view source on GitHub ↗
(toReplace: InjectionToken, options: any)

Source from the content-addressed store, hash-verified

535 }
536
537 public replace(toReplace: InjectionToken, options: any) {
538 if (options.isProvider && this.hasProvider(toReplace)) {
539 const originalProvider = this._providers.get(toReplace);
540
541 return originalProvider!.mergeWith({ provide: toReplace, ...options });
542 } else if (!options.isProvider && this.hasInjectable(toReplace)) {
543 const originalInjectable = this._injectables.get(toReplace);
544
545 return originalInjectable!.mergeWith({
546 provide: toReplace,
547 ...options,
548 });
549 }
550 }
551
552 public hasProvider(token: InjectionToken): boolean {
553 return this._providers.has(token);

Callers 15

stringCleanerFunction · 0.45
module.spec.tsFile · 0.45
tryConvertMethod · 0.45
sanitizeMethod · 0.45
HolderFunction · 0.45
removeDuplicateSlashesFunction · 0.45
normalizePathFunction · 0.45

Calls 4

hasProviderMethod · 0.95
hasInjectableMethod · 0.95
mergeWithMethod · 0.80
getMethod · 0.65

Tested by 1

convertInspectToJSONFunction · 0.36