2014-10-10 02:22:38 +00:00
|
|
|
var has_buf = (typeof Buffer !== 'undefined');
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2017-02-10 19:23:01 +00:00
|
|
|
function cc2str(arr)/*:string*/ {
|
2015-04-02 20:32:22 +00:00
|
|
|
var o = "";
|
|
|
|
for(var i = 0; i != arr.length; ++i) o += String.fromCharCode(arr[i]);
|
|
|
|
return o;
|
|
|
|
}
|
2017-02-03 20:50:45 +00:00
|
|
|
|
2017-02-10 19:23:01 +00:00
|
|
|
function dup(o/*:any*/)/*:any*/ {
|
2017-02-03 20:50:45 +00:00
|
|
|
if(typeof JSON != 'undefined') return JSON.parse(JSON.stringify(o));
|
|
|
|
if(typeof o != 'object' || !o) return o;
|
|
|
|
var out = {};
|
|
|
|
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
|
|
|
return out;
|
|
|
|
}
|