From 586e73e1e45ff254f23f493fc7ac6534f5590c24 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 8 May 2015 23:18:10 -0600 Subject: [PATCH] make easier to use in browser, removed unused vars --- lib/gzip.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/gzip.js b/lib/gzip.js index 9dc8f1e..bfcdb9b 100644 --- a/lib/gzip.js +++ b/lib/gzip.js @@ -1,8 +1,8 @@ -(function () { +(function (exports) { 'use strict'; - var crc32 = require('crc32'), - deflate = require('deflate-js'), + var crc32 = exports.crc32 || require('crc32'), + deflate = exports.deflate || require('deflate-js'), // magic numbers marking this file as GZIP ID1 = 0x1F, ID2 = 0x8B, @@ -126,7 +126,7 @@ function zip(data, options) { var flags = 0, level, - crc, out = []; + out = []; if (!options) { options = {}; @@ -184,7 +184,7 @@ return out; } - function unzip(data, options) { + function unzip(data/*, options*/) { // start with a copy of the array var arr = Array.prototype.slice.call(data, 0), t, @@ -192,7 +192,6 @@ flags, mtime, xFlags, - key, os, crc, size, @@ -270,11 +269,11 @@ return res; } - module.exports = { - zip: zip, - unzip: unzip, - get DEFAULT_LEVEL() { + exports.zip = zip; + exports.unzip = unzip; + Object.defineProperty(exports, 'DEFAULT_LEVEL', { + get: function () { return DEFAULT_LEVEL; } - }; -}()); + }); +}('undefined' !== typeof window ? window : exports));