mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
14 lines
256 B
JavaScript
14 lines
256 B
JavaScript
import {StreamBase} from './base';
|
|
|
|
export class MapStream extends StreamBase {
|
|
|
|
constructor(stream, fn) {
|
|
super();
|
|
this.stream = stream;
|
|
this.fn = fn;
|
|
}
|
|
|
|
attach(observer) {
|
|
return this.stream.attach(v => observer(this.fn(v)));
|
|
}
|
|
}
|