Home Manual Reference Source Test Repository

src/tools/map.js


import { fromiterable } from './from' ;
import { toiterable } from './to' ;
import { map as _map } from 'aureooms-js-itertools' ;

/**
 * Applies a callable to each token of a stream.
 * @param {Callable} callable the callable to apply
 * @param {Stream} stream the stream to process
 */
export function map ( callable , stream ) {

	return fromiterable( _map( callable , toiterable( stream ) ) ) ;

}