Skip to content

Commit

Permalink
optimize stream push
Browse files Browse the repository at this point in the history
Signed-off-by: francesco <[email protected]>
  • Loading branch information
cesco69 authored Apr 15, 2024
1 parent 604cc40 commit 5f99abc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,7 @@ function buildInnerObject (context, location) {
addComma = 'json += \',\''
}
}
if (context.options.enableStream) {
code += `
if( json ){
stream.push(json)
json = '';
}
`
}

if (schema.patternProperties || schema.additionalProperties) {
code += buildExtraObjectPropertiesSerializer(context, location, addComma)
}
Expand All @@ -420,8 +413,10 @@ function buildInnerObject (context, location) {

if (context.options.enableStream) {
code += `
stream.push(json)
json = ''
if( json ){
stream.push(json)
json = ''
}
`
}

Expand Down

0 comments on commit 5f99abc

Please sign in to comment.