diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-04 20:51:58 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-04 20:51:58 +0200 |
| commit | 8d3df83e75cc7638ead0c5231faa67d0b9a7b590 (patch) | |
| tree | b710c2713af13f3c8cffef130483ea0c84723a28 /worker.js | |
| parent | c1b3c028e1284027ebc0e674e7c93cd0fd9e2d12 (diff) | |
| download | processor-8d3df83e75cc7638ead0c5231faa67d0b9a7b590.tar.gz processor-8d3df83e75cc7638ead0c5231faa67d0b9a7b590.zip | |
filter undefined or null objects
Diffstat (limited to 'worker.js')
| -rw-r--r-- | worker.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -86,7 +86,9 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI, } // helper: true if object is not in record arr - let is_in = (arr, obj) => arr.map((o) => o.api_id).indexOf(obj.api_id) > -1; + // also, sort out invalid objects (undefined or null) + let is_in = (arr, obj) => obj == undefined || + arr.map((o) => o.api_id).indexOf(obj.api_id) > -1; // we aggregate record objects to do a bulk insert |
