aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-04 10:26:32 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-04 10:26:32 -0700
commit1e7414017b599d7b3b990922ca905ee679b81ff9 (patch)
tree78309c33c75f57bcf2f4a13054d1c7c47005c2d5
parent61cab495da3dd69cc46bef0ae8786ecec8050481 (diff)
refactor chunkifying in makePointer
-rw-r--r--src/parseTools.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 671aed69..2d0be302 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1539,7 +1539,6 @@ function makePointer(slab, pos, allocator, type, ptr) {
}
if (!fail) types = 'i8';
}
- if (typeof slab == 'object') slab = '[' + slab.join(',') + ']';
// JS engines sometimes say array initializers are too large. Work around that by chunking and calling concat to combine at runtime
var chunkSize = 10240;
function chunkify(array) {
@@ -1552,9 +1551,10 @@ function makePointer(slab, pos, allocator, type, ptr) {
}
return ret;
}
- if (typeof slab == 'string' && evaled && evaled.length > chunkSize && slab.length > chunkSize) {
- slab = chunkify(evaled);
+ if (typeof slab == 'object' && slab.length > chunkSize) {
+ slab = chunkify(slab);
}
+ if (typeof slab == 'object') slab = '[' + slab.join(',') + ']';
if (typeof types != 'string' && types.length > chunkSize) {
types = chunkify(types);
} else {