aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/stream-utils.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-04-09 05:24:10 +0800
committerkumavis <aaron@kumavis.me>2016-04-09 05:24:10 +0800
commit266e3c7ddb920c933355d559144bab6c633a65fb (patch)
treece57869cb3f9eed23c6ff717004668a366a315dc /app/scripts/lib/stream-utils.js
parent379294f16415a6ca112c590b1bcc12448189d245 (diff)
downloadtangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.gz
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.bz2
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.lz
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.xz
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.zst
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.zip
popup - fix web3 plumbing
Diffstat (limited to 'app/scripts/lib/stream-utils.js')
-rw-r--r--app/scripts/lib/stream-utils.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/scripts/lib/stream-utils.js b/app/scripts/lib/stream-utils.js
new file mode 100644
index 000000000..12560ffd8
--- /dev/null
+++ b/app/scripts/lib/stream-utils.js
@@ -0,0 +1,21 @@
+const Through = require('through2')
+
+
+module.exports = {
+ jsonParseStream: jsonParseStream,
+ jsonStringifyStream: jsonStringifyStream,
+}
+
+function jsonParseStream(){
+ return Through.obj(function(serialized, encoding, cb){
+ this.push(JSON.parse(serialized))
+ cb()
+ })
+}
+
+function jsonStringifyStream(){
+ return Through.obj(function(obj, encoding, cb){
+ this.push(JSON.stringify(obj))
+ cb()
+ })
+}