mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
feature(util) add back isArrayBuffer
This commit is contained in:
parent
cd9d89f58f
commit
35816b5121
3 changed files with 19 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
11
lib/util.js
11
lib/util.js
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue