Skip to content

Commit

Permalink
spread: removed unnecessary sample
Browse files Browse the repository at this point in the history
  • Loading branch information
earthspacon committed Jul 26, 2024
1 parent dc67148 commit 425a22b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/spread/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,14 @@ export function spread<P>(
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<any>,
batch: false,
});
}
}
Expand Down

0 comments on commit 425a22b

Please sign in to comment.