summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-04 21:03:28 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-04 21:03:28 +0200
commita6b1c4139a485595fd858fa447d893725d43a015 (patch)
treedfa4f895da50dd55d520ab6e56b0d6e22d8cdec3
parentde9bd96b5ccda3b9a354cf3e02d49012bdc177d4 (diff)
downloadcompiler-a6b1c4139a485595fd858fa447d893725d43a015.tar.gz
compiler-a6b1c4139a485595fd858fa447d893725d43a015.zip
filter undefined or null objects
-rw-r--r--worker.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/worker.js b/worker.js
index d0d6ca0..b277eca 100644
--- a/worker.js
+++ b/worker.js
@@ -64,8 +64,10 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI || "amqp://localhost",
// processor sends to queue with a custom "type" so compiler can filter
// m.content: player.api_id
- let players = msgs.filter((m) => m.properties.type == "player").map((m) => JSON.parse(m.content)),
- participants = msgs.filter((m) => m.properties.type == "participant").map((m) => JSON.parse(m.content));
+ let players = msgs.filter((m) => m.properties.type == "player").map(
+ (m) => JSON.parse(m.content)).filter((p) => p != undefined),
+ participants = msgs.filter((m) => m.properties.type == "participant").map(
+ (m) => JSON.parse(m.content)).filter((p) => p != undefined);
// collect information and populate _record arrays
await Promise.all([