refactor(packer) unpack: checkExt -> regexp

This commit is contained in:
coderaiser 2014-12-03 09:51:03 -05:00
parent 220da11388
commit 846f91997b

View file

@ -61,19 +61,16 @@
exports.unpack = function(from, to, callback) {
var write,
isStr = Util.type.string(from),
check = Util.checkExt,
isTarGz = isStr && check(from, 'tar.gz'),
isTarGz = /\.tar\.gz$/.test(from),
options = {
gunzip : true
};
if (tar && isTarGz) {
if (isTarGz)
write = tar.Extract({ path: to });
} else {
else
write = to;
}
files.pipe(from, write, options, callback);
};