Function STOP

Use return STOP or return STOP(returnValue) to stop iteration in callback functions, like map, filter, take etc.

The STOP(returnValue) (experimental), where returnValue is included as the last item of the iteration. @todo(444): test it's projecting the value through any possible options.map

Can be used everywhere (each, filter, take as well as map, reduce etc).

  • for boolean returning callbacks (eg filter returning false only filters/rejects current item), to stop the iteration.
  • for value returning callbacks (eg reduce, map), You can either stop with return STOP (without calling it), or return STOP(someValue) to provide the last value of the mapping. @todo(444): test this