Skip to content

Commit 4b50653

Browse files
authored
systems like pulsar subscriber can exit/break without returning a value, and will generate {done:true, value:undefined} which should not be pumped (#96)
1 parent 534d729 commit 4b50653

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stated-js",
3-
"version": "0.1.48",
3+
"version": "0.1.49",
44
"license": "Apache-2.0",
55
"description": "JSONata embedded in JSON",
66
"main": "./dist/src/index.js",

src/utils/GeneratorManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export class GeneratorManager{
154154
done,
155155
return: TemplateProcessor.wrapInOrdinaryFunction(generator.return.bind(generator))
156156
};
157+
//done with undefined value indicates generator function has finished without an explicit return value
158+
if(done && item===undefined){
159+
break;
160+
}
157161

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

0 commit comments

Comments
 (0)