diff options
author | alon@honor <none@none> | 2010-08-29 20:39:36 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-08-29 20:39:36 -0700 |
commit | 7a0103b77e09097aa73ee8e137d826e6049bd2ac (patch) | |
tree | 5d5fed852c7234cd1180993618f9640b4212778c /src/utility.js | |
parent | c203d5c8e027a2cf0bea23540fc0edf93e4e37eb (diff) |
clean up segments from noalias etc.
Diffstat (limited to 'src/utility.js')
-rw-r--r-- | src/utility.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/utility.js b/src/utility.js index 94a2132a..bcff0b65 100644 --- a/src/utility.js +++ b/src/utility.js @@ -1,7 +1,21 @@ function dump(item) { + function lineify(text) { + var ret = ''; + while (text.length > 0) { + if (text.length < 80) { + ret += text; + return ret; + } + var subText = text.substring(60, 80); + var index = 61+Math.max(subText.indexOf(','), subText.indexOf(']'), subText.indexOf('}'), 21); + ret += text.substr(0,index) + '\n'; + text = '// ' + text.substr(index); + } + } + try { - return JSON.stringify(item).substr(0,200); + return lineify(JSON.stringify(item)); } catch(e) { var ret = []; for (var i in item) { @@ -12,7 +26,7 @@ function dump(item) { ret.push(i + ': [?]'); } } - return ret.join(', ').substr(0,200); + return lineify(ret.join(', ')); } } |