aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/obj-multiplex.js
diff options
context:
space:
mode:
authorsdtsui <szehungdanieltsui@gmail.com>2017-08-07 10:55:34 +0800
committersdtsui <szehungdanieltsui@gmail.com>2017-08-07 10:55:34 +0800
commit02c2106c3bb6900801cf5ffe4a1d9bd46183b089 (patch)
tree23f6d76a57c7b58a385ee49e8a24e402ed474775 /app/scripts/lib/obj-multiplex.js
parentfd36d95c506db55afa33a251c6c187c194a55854 (diff)
parent2ba5737728d2539fc3bc9015e440f37341219cdc (diff)
downloadtangerine-wallet-browser-02c2106c3bb6900801cf5ffe4a1d9bd46183b089.tar
tangerine-wallet-browser-02c2106c3bb6900801cf5ffe4a1d9bd46183b089.tar.gz
tangerine-wallet-browser-02c2106c3bb6900801cf5ffe4a1d9bd46183b089.tar.bz2
tangerine-wallet-browser-02c2106c3bb6900801cf5ffe4a1d9bd46183b089.tar.lz
tangerine-wallet-browser-02c2106c3bb6900801cf5ffe4a1d9bd46183b089.tar.xz
tangerine-wallet-browser-02c2106c3bb6900801cf5ffe4a1d9bd46183b089.tar.zst
tangerine-wallet-browser-02c2106c3bb6900801cf5ffe4a1d9bd46183b089.zip
Merge branch 'master' into feat/mm-ui-5
Diffstat (limited to 'app/scripts/lib/obj-multiplex.js')
-rw-r--r--app/scripts/lib/obj-multiplex.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/scripts/lib/obj-multiplex.js b/app/scripts/lib/obj-multiplex.js
index bd114c394..0034febe0 100644
--- a/app/scripts/lib/obj-multiplex.js
+++ b/app/scripts/lib/obj-multiplex.js
@@ -5,12 +5,16 @@ module.exports = ObjectMultiplex
function ObjectMultiplex (opts) {
opts = opts || {}
// create multiplexer
- var mx = through.obj(function (chunk, enc, cb) {
- var name = chunk.name
- var data = chunk.data
- var substream = mx.streams[name]
+ const mx = through.obj(function (chunk, enc, cb) {
+ const name = chunk.name
+ const data = chunk.data
+ if (!name) {
+ console.warn(`ObjectMultiplex - Malformed chunk without name "${chunk}"`)
+ return cb()
+ }
+ const substream = mx.streams[name]
if (!substream) {
- console.warn(`orphaned data for stream "${name}"`)
+ console.warn(`ObjectMultiplex - orphaned data for stream "${name}"`)
} else {
if (substream.push) substream.push(data)
}
@@ -19,7 +23,7 @@ function ObjectMultiplex (opts) {
mx.streams = {}
// create substreams
mx.createStream = function (name) {
- var substream = mx.streams[name] = through.obj(function (chunk, enc, cb) {
+ const substream = mx.streams[name] = through.obj(function (chunk, enc, cb) {
mx.push({
name: name,
data: chunk,