From 00d08fa3f223e1c7d1c05e0350c236d1c4e32d09 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Fri, 2 Mar 2018 14:34:32 +0100 Subject: [PATCH] use ternary for buffer.from check --- index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 38a5e79..8323e65 100644 --- a/index.js +++ b/index.js @@ -3,12 +3,9 @@ var eos = require('end-of-stream') var inherits = require('inherits') var shift = require('stream-shift') -var SIGNAL_FLUSH -if (Buffer.from && Buffer.from !== Uint8Array.from) { - SIGNAL_FLUSH = Buffer.from([0]) -} else { - SIGNAL_FLUSH = new Buffer([0]) -} +var SIGNAL_FLUSH = (Buffer.from && Buffer.from !== Uint8Array.from) + ? Buffer.from([0]) + : new Buffer([0]) var onuncork = function(self, fn) { if (self._corked) self.once('uncork', fn)