Skip to main content

makeStepwiseIterator

function

A generalized utility for creating a stepwise iterator based on: - an initial state - a stop guard that returns true if the iteration is over, this is typically used to detect a sentinel value such as null or undefined from the state but may return true for other conditions as well - a step function that advances the state (this will be called after map each time next() is called to prepare the next state) - a map function that will be called that may transform the state before returning it. It will only be called once for each next() call when stop(state) === false

function makeStepwiseIterator<State, Stop, Value>(config: StepwiseIteratorConfig<State, Stop, Value>): IterableIterator<Value>

Import

import { makeStepwiseIterator } from '@modular/sdk/editor';

Notes

returns
An IterableIterator