Skip to content

Commit

Permalink
Merge pull request #44 from neonstalwart/first-write
Browse files Browse the repository at this point in the history
only write the opening '[' after the first object is received
  • Loading branch information
kriszyp committed Feb 25, 2015
2 parents 7fecf7f + a64636a commit c262939
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion media/json.js
Expand Up @@ -28,11 +28,11 @@ function StreamingSerializer(stringify){
write("{}&&");
}
// progressively stream arrays for better performance and memory
write("[")
var first = true;
var undefined; // make it a fast, closely-scoped lookup
return when(object.forEach(function(item){
if(first){
write("[")
first = false;
}
else{
Expand Down

0 comments on commit c262939

Please sign in to comment.