MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / getSync

Method getSync

packages/context/src/context.ts:777–795  ·  view source on GitHub ↗
(
    keyWithPath: BindingAddress<ValueType>,
    optionsOrSession?: ResolutionOptionsOrSession,
  )

Source from the content-addressed store, hash-verified

775
776 // Implementation
777 getSync<ValueType>(
778 keyWithPath: BindingAddress<ValueType>,
779 optionsOrSession?: ResolutionOptionsOrSession,
780 ): ValueType | undefined {
781 this.debug('Resolving binding synchronously: %s', keyWithPath);
782
783 const valueOrPromise = this.getValueOrPromise<ValueType>(
784 keyWithPath,
785 optionsOrSession,
786 );
787
788 if (isPromiseLike(valueOrPromise)) {
789 throw new Error(
790 `Cannot get ${keyWithPath} synchronously: the value is a promise`,
791 );
792 }
793
794 return valueOrPromise;
795 }
796
797 /**
798 * Look up a binding by key in the context and its ancestors. If no matching

Callers 15

assertProviderClassFunction · 0.95
componentMethod · 0.80
component.unit.tsFile · 0.80
componentMethod · 0.80
expectNoteRepoToBeBoundFunction · 0.80
expectComponentToBeBoundFunction · 0.80

Calls 3

debugMethod · 0.95
getValueOrPromiseMethod · 0.95
isPromiseLikeFunction · 0.90

Tested by 13

assertProviderClassFunction · 0.76
expectNoteRepoToBeBoundFunction · 0.64
expectComponentToBeBoundFunction · 0.64
constructorMethod · 0.64
customDecoratorFunction · 0.64
expectFooValueFunction · 0.64
expectComponentToBeBoundFunction · 0.64
getValidatorFunction · 0.64
handleMethod · 0.64
constructorMethod · 0.64
withConnectedSocketsFunction · 0.64