From 425a22b729db74dc28bde4cac401ab2cbdaa48ee Mon Sep 17 00:00:00 2001 From: earthspacon Date: Fri, 26 Jul 2024 17:18:28 +0500 Subject: [PATCH] spread: removed unnecessary sample --- src/spread/index.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/spread/index.ts b/src/spread/index.ts index 6dc5aa57..a6355fb6 100644 --- a/src/spread/index.ts +++ b/src/spread/index.ts @@ -70,18 +70,14 @@ export function spread

( if (hasOwnProp(targets, targetKey)) { const currentTarget = targets[targetKey]; - const hasTargetKey = sample({ - source, - batch: false, - filter: (object): object is any => - typeof object === 'object' && object !== null && targetKey in object, - }); - sample({ - batch: false, - clock: hasTargetKey, + source, + filter: (object): object is any => { + return typeof object === 'object' && object !== null && targetKey in object; + }, fn: (object: P) => object[targetKey], target: currentTarget as UnitTargetable, + batch: false, }); } }