Skip to content

collect

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/phet-core/blob/main/js/collect.ts for the most up-to-date information.

Overview

Creates an array of results from an iterator that takes a callback.

For instance, if calling a function f( g ) will call g( 1 ), g( 2 ), and g( 3 ), collect( function( callback ) { f( callback ); } ); will return [1,2,3].

@author Jonathan Olson <jonathan.olson@colorado.edu>

Source Code

See the source for collect.ts in the phet-core repository.