diff options
author | Joseph Dykstra <josephdykstra@gmail.com> | 2015-01-16 19:30:16 +0300 |
---|---|---|
committer | Joseph Dykstra <josephdykstra@gmail.com> | 2015-01-16 19:30:16 +0300 |
commit | 81427cd808d3fdc9af0e8161c7df3f40ba57e837 (patch) | |
tree | 9a8b46fc7b99781274949fe477b21ebe11e9225a /lib | |
parent | 366b8912a24f5e448c5dcf67854604e988c3df96 (diff) |
Use a map instead of multiple ternary statements
Diffstat (limited to 'lib')
-rw-r--r-- | lib/file-stream.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/file-stream.js b/lib/file-stream.js index 3b2cf23..2abfd61 100644 --- a/lib/file-stream.js +++ b/lib/file-stream.js @@ -101,13 +101,11 @@ FileStream.prototype.pipe = function (dst) { // <video> or <audio> tag if (dst && (dst.nodeName === 'VIDEO' || dst.nodeName === 'AUDIO')) { - var type = self._extname === '.webm' - ? 'video/webm; codecs="vorbis,vp8"' - : self._extname === '.mp4' - ? 'video/mp4; codecs="avc1.42c01e,mp4a.40.2"' - : self._extname === '.mp3' - ? 'audio/mpeg' - : undefined + var type = { + '.webm': 'video/webm; codecs="vorbis,vp8"', + '.mp4': 'video/mp4; codecs="avc1.42c01e,mp4a.40.2"', + '.mp3': 'audio/mpeg' + }[self._extname] return pipe.call(self, new MediaStream(dst, { type: type })) } else return pipe.call(self, dst) |