// i.e. first toggle starts collection, second one stops, third starts again, and so on.
When you know only the split value of each block, you can use the default split mode,
with carryEnd set to 1/forward (in case you do not want it skipped):
When you know both start and end values of each block, you can use the toggle mode,
with carryStart set to 1/forward, and carryEnd set to -1/back, unless you want
either of those skipped, then leave them at 0/none.
Note that in toggle mode, you cannot use carryStart=back (it will be ignored),
because it would delay emission of the current block indefinitely, plus carrying
block start backward doesn't make much sense anyway.
Note that the predicate can only return a Promise inside an asynchronous pipeline,
or else the Promise will be treated as a truthy value.
Splits values into separate lists when predicate returns
true(or resolves withtrue):When option
toggleis set, the split uses the toggle start/end logic:When you know only the split value of each block, you can use the default split mode, with
carryEndset to1/forward(in case you do not want it skipped):When you know only the end value of each block, you can use the default split mode, with
carryEndset to-1/back(in case you do not want it skipped):When you know both start and end values of each block, you can use the
togglemode, withcarryStartset to1/forward, andcarryEndset to-1/back, unless you want either of those skipped, then leave them at0/none.Note that in
togglemode, you cannot usecarryStart=back(it will be ignored), because it would delay emission of the current block indefinitely, plus carrying block start backward doesn't make much sense anyway.Note that the predicate can only return a
Promiseinside an asynchronous pipeline, or else thePromisewill be treated as a truthy value.