From ea7a951506b2f1686288903c859371f9c5f63069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20=C5=BDia=C4=8Dik?= Date: Mon, 20 Mar 2017 00:46:41 +0100 Subject: [PATCH] better dup check (fixes #316) --- bits/20_jsutils.js | 2 +- xlsx.flow.js | 2 +- xlsx.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bits/20_jsutils.js b/bits/20_jsutils.js index d12c438..2289e1d 100644 --- a/bits/20_jsutils.js +++ b/bits/20_jsutils.js @@ -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; diff --git a/xlsx.flow.js b/xlsx.flow.js index 1a05868..95f8e80 100644 --- a/xlsx.flow.js +++ b/xlsx.flow.js @@ -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; diff --git a/xlsx.js b/xlsx.js index 7c0ac53..dcc7a8d 100644 --- a/xlsx.js +++ b/xlsx.js @@ -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;