Skip to content

Commit

Permalink
systems like pulsar subscriber can exit/break without returning a val…
Browse files Browse the repository at this point in the history
…ue, and will generate {done:true, value:undefined} which should not be pumped (#96)
  • Loading branch information
geoffhendrey authored Jan 8, 2025
1 parent 534d729 commit 4b50653
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stated-js",
"version": "0.1.48",
"version": "0.1.49",
"license": "Apache-2.0",
"description": "JSONata embedded in JSON",
"main": "./dist/src/index.js",
Expand Down
4 changes: 4 additions & 0 deletions src/utils/GeneratorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ export class GeneratorManager{
done,
return: TemplateProcessor.wrapInOrdinaryFunction(generator.return.bind(generator))
};
//done with undefined value indicates generator function has finished without an explicit return value
if(done && item===undefined){
break;
}

// Pass the entire item object to setData
await templateProcessor.setData(metaInfo.jsonPointer__ as string, item, "forceSetInternal");
Expand Down

0 comments on commit 4b50653

Please sign in to comment.