From 03a255285e5602a103ebf69fb4272eff78c9f141 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 31 Mar 2014 09:03:51 -0400 Subject: [PATCH] chore(zip) UTF8 -> UTF8Proto --- lib/client/zip.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/client/zip.js b/lib/client/zip.js index 859fa49b..7c71c0c6 100644 --- a/lib/client/zip.js +++ b/lib/client/zip.js @@ -3,13 +3,9 @@ var Util, Zip, pako; (function () { 'use strict'; - /*jshint nonstandard:false */ - var UTF8 = { - unescape: typeof unescape === 'function' ? unescape : decode - }; - /*jshint nonstandard:true */ - - Zip = new ZipProto(); + var UTF8 = new UTF8Proto(); + + Zip = new ZipProto(); function ZipProto() { this.pack = function(str, callback) { @@ -44,13 +40,23 @@ var Util, Zip, pako; return arr; } - } + } - /* jshint bitwise:false */ - /* unescape polyfill + function UTF8Proto() { + /*jshint nonstandard:true */ + var isUnescape = typeof unescape === 'function', + func = isUnescape ? unescape : decode; + + this.unescape = func; + } + + /* + * unescape polyfill * http://unixpapa.com/js/querystring.html */ + function decode(s) { + /*jshint bitwise:false */ s = s.replace(/%([EF][0-9A-F])%([89AB][0-9A-F])%([89AB][0-9A-F])/gi, function(code,hex1,hex2,hex3) { var n, n3, @@ -88,5 +94,4 @@ var Util, Zip, pako; return s; } - /* jshint bitwise:true */ })();