From 3da78340cb0cbe9ac06623bf4694b7bac7e59d28 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Tue, 25 Mar 2014 20:48:23 +0100 Subject: [PATCH] normalizing style --- extract.js | 2 +- headers.js | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/extract.js b/extract.js index 280ef55..60b3351 100644 --- a/extract.js +++ b/extract.js @@ -79,7 +79,7 @@ var Extract = function(opts) { try { header = self._header = headers.decode(b.slice(0, 512)); } catch (err) { - self.emit('error', err) + self.emit('error', err); } b.consume(512); diff --git a/headers.js b/headers.js index cbc8697..c429060 100644 --- a/headers.js +++ b/headers.js @@ -196,23 +196,21 @@ exports.decode = function(buf) { if (c === 8*32) return null; //valid checksum - if (c === decodeOct(buf, 148)) - return { - name: name, - mode: mode, - uid: uid, - gid: gid, - size: size, - mtime: new Date(1000 * mtime), - type: toType(typeflag), - linkname: linkname, - uname: uname, - gname: gname, - devmajor: devmajor, - devminor: devminor - }; + if (c !== decodeOct(buf, 148)) throw new Error('invalid header'); - //invalid checksum - throw new Error('invalid header'); + return { + name: name, + mode: mode, + uid: uid, + gid: gid, + size: size, + mtime: new Date(1000 * mtime), + type: toType(typeflag), + linkname: linkname, + uname: uname, + gname: gname, + devmajor: devmajor, + devminor: devminor + }; };