better dup check (fixes #316)

This commit is contained in:
František Žiačik 2017-03-20 00:46:41 +01:00 committed by SheetJS
parent 912d586e8b
commit ea7a951506
3 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ function str2cc(str) {
function dup(o/*:any*/)/*:any*/ {
if(typeof JSON != 'undefined') return JSON.parse(JSON.stringify(o));
if(typeof o != 'object' || !o) return o;
if(typeof o != 'object' || o == null) return o;
var out = {};
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
return out;

View File

@ -1399,7 +1399,7 @@ function str2cc(str) {
function dup(o/*:any*/)/*:any*/ {
if(typeof JSON != 'undefined') return JSON.parse(JSON.stringify(o));
if(typeof o != 'object' || !o) return o;
if(typeof o != 'object' || o == null) return o;
var out = {};
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
return out;

View File

@ -1353,7 +1353,7 @@ function str2cc(str) {
function dup(o) {
if(typeof JSON != 'undefined') return JSON.parse(JSON.stringify(o));
if(typeof o != 'object' || !o) return o;
if(typeof o != 'object' || o == null) return o;
var out = {};
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
return out;