From: erickson Date: Mon, 18 Jul 2005 18:03:08 +0000 (+0000) Subject: basically reverted back - left the try catch X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=43afba45f1acb47c50477e58242e05ff720b9899;p=working%2FOpenSRF.git basically reverted back - left the try catch git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@403 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/javascript/JSON.js b/src/javascript/JSON.js index 7511f32..6994cfc 100644 --- a/src/javascript/JSON.js +++ b/src/javascript/JSON.js @@ -41,10 +41,20 @@ function object2Array(obj) { return arr; } + function js2JSON(arg) { + try { + return _js2JSON(arg); + } catch(E) { + //alert(E + "EX"); + if(arg && arg.toString) return arg.toString(); + return arg; + } +} + +function _js2JSON(arg) { var i, o, u, v; - try { switch (typeof arg) { case 'object': @@ -127,8 +137,5 @@ function js2JSON(arg) { default: return '"' + String(arg).replace(/(["\\])/g, '\\$1') + '"'; } - } catch(E) { - if(arg && arg.toString) return arg.toString(); - return arg; - } + }