(source, options = { __proto__: null })
| 649 | // ============================================================================= |
| 650 | |
| 651 | function share(source, options = { __proto__: null }) { |
| 652 | // Normalize source via from() - accepts strings, ArrayBuffers, protocols, etc. |
| 653 | const normalized = from(source); |
| 654 | validateObject(options, 'options'); |
| 655 | const { |
| 656 | highWaterMark = kMultiConsumerDefaultHWM, |
| 657 | backpressure = 'strict', |
| 658 | signal, |
| 659 | } = options; |
| 660 | validateInteger(highWaterMark, 'options.highWaterMark'); |
| 661 | validateBackpressure(backpressure); |
| 662 | if (signal !== undefined) { |
| 663 | validateAbortSignal(signal, 'options.signal'); |
| 664 | } |
| 665 | |
| 666 | const opts = { |
| 667 | __proto__: null, |
| 668 | highWaterMark: clampHWM(highWaterMark), |
| 669 | backpressure, |
| 670 | signal, |
| 671 | }; |
| 672 | |
| 673 | const shareImpl = new ShareImpl(normalized, opts); |
| 674 | |
| 675 | if (signal) { |
| 676 | onShareCancel(shareImpl, signal); |
| 677 | } |
| 678 | |
| 679 | return shareImpl; |
| 680 | } |
| 681 | |
| 682 | function shareSync(source, options = { __proto__: null }) { |
| 683 | // Normalize source via fromSync() - accepts strings, ArrayBuffers, protocols, etc. |
no test coverage detected
searching dependent graphs…