From 63877da56fa2f75596ac0e5f6e9a63ab344f3909 Mon Sep 17 00:00:00 2001 From: andreasrueedlinger Date: Fri, 14 Oct 2016 21:33:55 +0200 Subject: [PATCH] Fixes #391 --- src/serializers/text/binding_serializer.ts | 4 ++-- test/index.test.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/serializers/text/binding_serializer.ts b/src/serializers/text/binding_serializer.ts index 864d3f7..069c997 100644 --- a/src/serializers/text/binding_serializer.ts +++ b/src/serializers/text/binding_serializer.ts @@ -20,7 +20,7 @@ function serializeBinding( let _b: any = binding; props.forEach((prop) => { - if (_b[prop] !== undefined && _b[prop] !== null) { + if (_b[prop] !== undefined) { let val: any = _b[prop]; switch (prop) { case "type": @@ -30,7 +30,7 @@ function serializeBinding( val = scopeFormatter(_b[prop]); break; case "implementationType": - val = _b[prop].name; + val = _b[prop] && _b[prop].name; break; case "serviceIdentifier": val = serviceIdentifierFormatter(_b[prop]); diff --git a/test/index.test.ts b/test/index.test.ts index 5c55e73..bfb5112 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -532,6 +532,7 @@ describe("makeLoggerMiddleware", () => { " └── bindings\n" + " └── Binding : 0\n" + " └── type : ConstantValue\n" + + " └── implementationType : null\n" + " └── scope : Transient\n"; let lines = out.split("└── ")