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

Method toJSON

packages/context/src/binding.ts:977–999  ·  view source on GitHub ↗

* Convert to a plain JSON object

()

Source from the content-addressed store, hash-verified

975 * Convert to a plain JSON object
976 */
977 toJSON(): JSONObject {
978 const json: JSONObject = {
979 key: this.key,
980 scope: this.scope,
981 tags: this.tagMap,
982 isLocked: this.isLocked,
983 };
984 if (this.type != null) {
985 json.type = this.type;
986 }
987 switch (this._source?.type) {
988 case BindingType.CLASS:
989 json.valueConstructor = this._source?.value.name;
990 break;
991 case BindingType.PROVIDER:
992 json.providerConstructor = this._source?.value.name;
993 break;
994 case BindingType.ALIAS:
995 json.alias = this._source?.value.toString();
996 break;
997 }
998 return json;
999 }
1000
1001 /**
1002 * Inspect the binding to return a json representation of the binding information

Callers 5

inspectMethod · 0.95
pushBindingMethod · 0.45
popBindingMethod · 0.45
binding.unit.tsFile · 0.45
context.unit.tsFile · 0.45

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected