diff options
author | alon@honor <none@none> | 2010-10-23 11:24:35 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-23 11:24:35 -0700 |
commit | bdf551e4e041814bab99f0f774684fb3c5bd812f (patch) | |
tree | 5a556136aaec037ffa07387f56b2c2ea9ac8f51f /src/utility.js | |
parent | 3e7515aa768ada28f640c172a7c355146e75004d (diff) |
optimize out unneeded item[0]
Diffstat (limited to 'src/utility.js')
-rw-r--r-- | src/utility.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/utility.js b/src/utility.js index c28077e8..3085fc61 100644 --- a/src/utility.js +++ b/src/utility.js @@ -1,15 +1,16 @@ // General JS utilities function dump(item) { + var CHUNK = 500; function lineify(text) { var ret = ''; while (text.length > 0) { - if (text.length < 80) { + if (text.length < CHUNK) { ret += text; return ret; } - var subText = text.substring(60, 80); - var index = 61+Math.max(subText.indexOf(','), subText.indexOf(']'), subText.indexOf('}'), 21); + var subText = text.substring(CHUNK-20, CHUNK); + var index = CHUNK-19+Math.max(subText.indexOf(','), subText.indexOf(']'), subText.indexOf('}'), 21); ret += text.substr(0,index) + '\n'; text = '// ' + text.substr(index); } |