UNPKG

1.14 kBJavaScriptView Raw
1import { from } from '../asynciterable/from';
2import { publish } from './operators/publish';
3import { IterableX } from '../iterable/iterablex';
4import { toDOMStream as asyncIterableToDOMStream } from '../asynciterable/todomstream';
5export function toDOMStream(source, options) {
6 if (!options || !('type' in options) || options['type'] !== 'bytes') {
7 return asyncIterableToDOMStream(from(source), options);
8 }
9 return asyncIterableToDOMStream(from(source), options);
10}
11IterableX.prototype.tee = function () {
12 return _getDOMStream(this).tee();
13};
14IterableX.prototype.pipeTo = function (writable, options) {
15 return _getDOMStream(this).pipeTo(writable, options);
16};
17IterableX.prototype.pipeThrough = function (duplex, options) {
18 return _getDOMStream(this).pipeThrough(duplex, options);
19};
20function _getDOMStream(self) {
21 return self._DOMStream || (self._DOMStream = self.pipe(publish(), toDOMStream));
22}
23export function toDOMStreamProto(options) {
24 return !options ? toDOMStream(this) : toDOMStream(this, options);
25}
26IterableX.prototype.toDOMStream = toDOMStreamProto;
27
28//# sourceMappingURL=todomstream.mjs.map