diff options
| author | Marak Squires <[email protected]> | 2011-12-28 03:45:01 -0800 |
|---|---|---|
| committer | Marak Squires <[email protected]> | 2011-12-28 03:45:01 -0800 |
| commit | 3ee94bb7ec0fbfe46c1bffac2e0658d103e03e4f (patch) | |
| tree | 535f415dc893e2a0bed430ce45bab4c9bb28e25b /tests | |
| parent | af47db9be83e285d0728447dbd8d8813cf58fd72 (diff) | |
| parent | 84ab59342f333bc33a992ec5ca37d8716295a536 (diff) | |
| download | faker-3ee94bb7ec0fbfe46c1bffac2e0658d103e03e4f.tar.xz faker-3ee94bb7ec0fbfe46c1bffac2e0658d103e03e4f.zip | |
Merge pull request #14 from aratak/trailing_spaces
[dist] Code cleanup
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/browser_test.html | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/browser_test.html b/tests/browser_test.html index 4bbaf759..91511cdf 100644 --- a/tests/browser_test.html +++ b/tests/browser_test.html @@ -8,23 +8,23 @@ // implement JSON.stringify serialization var JSON = {}; JSON.stringify = function (obj) { - var t = typeof (obj); - if (t != "object" || obj === null) { - // simple data type - if (t == "string") obj = '"'+obj+'"'; - return String(obj); - } - else { - // recurse array or object - var n, v, json = [], arr = (obj && obj.constructor == Array); - for (n in obj) { - v = obj[n]; t = typeof(v); - if (t == "string") v = '"'+v+'"'; - else if (t == "object" && v !== null) v = JSON.stringify(v); - json.push((arr ? "" : '"' + n + '":') + String(v)); - } - return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}"); - } + var t = typeof (obj); + if (t != "object" || obj === null) { + // simple data type + if (t == "string") obj = '"'+obj+'"'; + return String(obj); + } + else { + // recurse array or object + var n, v, json = [], arr = (obj && obj.constructor == Array); + for (n in obj) { + v = obj[n]; t = typeof(v); + if (t == "string") v = '"'+v+'"'; + else if (t == "object" && v !== null) v = JSON.stringify(v); + json.push((arr ? "" : '"' + n + '":') + String(v)); + } + return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}"); + } }; } document.write(JSON.stringify(card)); |
