feature(util) add back isArrayBuffer

This commit is contained in:
coderaiser 2014-05-11 13:18:20 -04:00
parent cd9d89f58f
commit 35816b5121
3 changed files with 19 additions and 3 deletions

View file

@ -123,12 +123,13 @@ var Util, DOM, CloudFunc, CloudCmd;
CloudCmd.getConfig(function(config) {
var data,
isString = Util.isString(p.data),
isArrayBuffer = Util.isArrayBuffer(p.data),
isFile = Util.isFile(p.data);
if (Util.isString(p.url))
p.url = decodeURI(p.url);
if (p.data && !isString && !isFile)
if (p.data && !isString && !isArrayBuffer && !isFile)
data = Util.stringifyJSON(p.data);
else
data = p.data;

View file

@ -9,9 +9,13 @@ var Util, Zip, pako;
function ZipProto() {
this.pack = function(str, callback) {
var buf, deflate, result;
var buf, deflate, result,
isArrayBuffer = Util.isArrayBuffer(str);
buf = utf8AbFromStr(str);
if (isArrayBuffer)
buf = str;
else
buf = utf8AbFromStr(str);
deflate = new pako.Deflate({
gzip:true

View file

@ -578,6 +578,17 @@
return Array.isArray(variable);
};
/**
* functions check is variable is arrayBuffer
* @param variable
*/
this.isArrayBuffer = function(variable) {
var type = this.getType(variable),
is = type === 'arraybuffer';
return is;
};
/**
* functions check is variable is boolean
* @param variable