From 56919fa0246682e1abcae560027be99ad2a2014d Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Fri, 21 May 2021 08:29:33 +1000 Subject: [PATCH] refactor: destructure options outside of op func --- src/internal/operators/share.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/internal/operators/share.ts b/src/internal/operators/share.ts index d4cadfa91c..013dea8413 100644 --- a/src/internal/operators/share.ts +++ b/src/internal/operators/share.ts @@ -134,6 +134,7 @@ export function share(options: ShareConfig): MonoTypeOperatorFunction; * @return A function that returns an Observable that mirrors the source. */ export function share(options: ShareConfig = {}): MonoTypeOperatorFunction { + const { connector = () => new Subject(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options; // It's necessary to use a wrapper here, as the _operator_ must be // referentially transparent. Otherwise, it cannot be used in calls to the // static `pipe` function - to create a reusable pipeline. @@ -143,8 +144,6 @@ export function share(options: ShareConfig = {}): MonoTypeOperatorFunction // _operator function_ is called when the complete pipeline is composed - not // when the static `pipe` function is called. return (wrapperSource) => { - const { connector = () => new Subject(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options; - let connection: SafeSubscriber | null = null; let resetConnection: Subscription | null = null; let subject: SubjectLike | null = null;