mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
14 lines
No EOL
248 B
JavaScript
14 lines
No EOL
248 B
JavaScript
export function intercept(stream, interceptor) {
|
|
|
|
stream._realNext = stream.next;
|
|
|
|
stream.next = function(value) {
|
|
|
|
const next = (value) => {
|
|
this._realNext(value);
|
|
};
|
|
|
|
interceptor(value, stream, next);
|
|
};
|
|
return stream;
|
|
} |