From 68b3f8d7b7c1d64c9be85f863a9b8d292cf0a629 Mon Sep 17 00:00:00 2001 From: Dmitry Boldyrev Date: Fri, 10 Nov 2023 14:21:29 +0600 Subject: [PATCH] Use skipVoid false --- src/and/index.ts | 2 +- src/combine-events/index.ts | 2 +- src/condition/index.ts | 2 +- src/either/index.ts | 2 +- src/empty/index.ts | 2 +- src/equals/index.ts | 4 +++- src/every/index.ts | 4 ++-- src/format/index.ts | 2 +- src/in-flight/index.ts | 2 +- src/interval/index.ts | 2 +- src/not/index.ts | 2 +- src/or/index.ts | 2 +- src/pending/index.ts | 2 +- src/reshape/index.ts | 2 +- src/some/index.ts | 4 ++-- 15 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/and/index.ts b/src/and/index.ts index ece96011..ca417ff3 100644 --- a/src/and/index.ts +++ b/src/and/index.ts @@ -11,6 +11,6 @@ export function and(...stores: Array>): Store { } return true; }, - { skipVoid: true }, + { skipVoid: false }, ) as Store; } diff --git a/src/combine-events/index.ts b/src/combine-events/index.ts index 54baefee..b15fc514 100644 --- a/src/combine-events/index.ts +++ b/src/combine-events/index.ts @@ -96,7 +96,7 @@ export function combineEvents

({ sample({ source: eventsTrriggered, - filter: $counter.map((value) => value === 0, { skipVoid: true }), + filter: $counter.map((value) => value === 0, { skipVoid: false }), target: target as UnitTargetable, }); }); diff --git a/src/condition/index.ts b/src/condition/index.ts index 20ffc051..fdf36043 100644 --- a/src/condition/index.ts +++ b/src/condition/index.ts @@ -130,7 +130,7 @@ function inverse( fnOrUnit: Store | ((payload: T) => boolean), ): Store | ((payload: T) => boolean) { if (is.unit(fnOrUnit)) { - return fnOrUnit.map((value) => !value, { skipVoid: true }); + return fnOrUnit.map((value) => !value, { skipVoid: false }); } return (value) => !fnOrUnit(value); } diff --git a/src/either/index.ts b/src/either/index.ts index c24b42a6..725a4528 100644 --- a/src/either/index.ts +++ b/src/either/index.ts @@ -64,7 +64,7 @@ export function either( then as Store, other as Store, (filter, then, other) => (filter ? then : other), - { skipVoid: true }, + { skipVoid: false }, ); } diff --git a/src/empty/index.ts b/src/empty/index.ts index 72d80b2e..e0ce406a 100644 --- a/src/empty/index.ts +++ b/src/empty/index.ts @@ -1,5 +1,5 @@ import { Store } from 'effector'; export function empty(source: Store): Store { - return source.map((value) => value == null, { skipVoid: true }); + return source.map((value) => value == null, { skipVoid: false }); } diff --git a/src/equals/index.ts b/src/equals/index.ts index 8960ebec..95b6dba7 100644 --- a/src/equals/index.ts +++ b/src/equals/index.ts @@ -25,5 +25,7 @@ export function equals( ? B : { error: 'argument b should extends a' }, ): Store { - return combine(a as Store, b as Store, (a, b) => a === b, { skipVoid: true }); + return combine(a as Store, b as Store, (a, b) => a === b, { + skipVoid: false, + }); } diff --git a/src/every/index.ts b/src/every/index.ts index f1100593..70a072a8 100644 --- a/src/every/index.ts +++ b/src/every/index.ts @@ -52,7 +52,7 @@ export function every( checker = predicate; } else if (is.store(predicate)) { checker = predicate.map((value) => (required: T) => value === required, { - skipVoid: true, + skipVoid: false, }); } else { checker = (value: T) => value === predicate; @@ -63,7 +63,7 @@ export function every( const $checker = checker as Store<(value: T) => boolean>; return combine($checker, $values, (checker, values) => values.every(checker), { - skipVoid: true, + skipVoid: false, }); } diff --git a/src/format/index.ts b/src/format/index.ts index c56d7448..51b80397 100644 --- a/src/format/index.ts +++ b/src/format/index.ts @@ -27,7 +27,7 @@ export function format[]>( ), '', ), - { skipVoid: true }, + { skipVoid: false }, ); } diff --git a/src/in-flight/index.ts b/src/in-flight/index.ts index 97689bfe..16126df4 100644 --- a/src/in-flight/index.ts +++ b/src/in-flight/index.ts @@ -22,6 +22,6 @@ export function inFlight({ return combine( effects!.map((fx) => fx.inFlight), (inFlights) => inFlights.reduce((all, current) => all + current, 0), - { skipVoid: true }, + { skipVoid: false }, ); } diff --git a/src/interval/index.ts b/src/interval/index.ts index 32ba830f..4964cc5a 100644 --- a/src/interval/index.ts +++ b/src/interval/index.ts @@ -34,7 +34,7 @@ export function interval({ const $isRunning = createStore(false); const $timeout = toStoreNumber(timeout); - const $notRunning = $isRunning.map((running) => !running, { skipVoid: true }); + const $notRunning = $isRunning.map((running) => !running, { skipVoid: false }); const saveTimeout = createEvent<{ timeoutId: NodeJS.Timeout; diff --git a/src/not/index.ts b/src/not/index.ts index 33c3550a..f8f081a2 100644 --- a/src/not/index.ts +++ b/src/not/index.ts @@ -1,5 +1,5 @@ import { Store } from 'effector'; export function not(source: Store): Store { - return source.map((value) => !value, { skipVoid: true }); + return source.map((value) => !value, { skipVoid: false }); } diff --git a/src/or/index.ts b/src/or/index.ts index 91e75066..7803e7c3 100644 --- a/src/or/index.ts +++ b/src/or/index.ts @@ -11,6 +11,6 @@ export function or(...stores: Array>): Store { } return false; }, - { skipVoid: true }, + { skipVoid: false }, ) as Store; } diff --git a/src/pending/index.ts b/src/pending/index.ts index 1133e781..0ec028d6 100644 --- a/src/pending/index.ts +++ b/src/pending/index.ts @@ -40,6 +40,6 @@ export function pending({ return combine( effects.map((fx) => fx.pending), strategy, - { skipVoid: true }, + { skipVoid: false }, ); } diff --git a/src/reshape/index.ts b/src/reshape/index.ts index 1d402b5e..4aac195b 100644 --- a/src/reshape/index.ts +++ b/src/reshape/index.ts @@ -28,7 +28,7 @@ export function reshape>({ const result = fn(state); return result === undefined ? null : result; }, - { skipVoid: true }, + { skipVoid: false }, ); } diff --git a/src/some/index.ts b/src/some/index.ts index 5826298f..9f7e3550 100644 --- a/src/some/index.ts +++ b/src/some/index.ts @@ -49,7 +49,7 @@ export function some( checker = predicate; } else if (is.store(predicate)) { checker = predicate.map((value) => (required: T) => value === required, { - skipVoid: true, + skipVoid: false, }); } else { checker = (value: T) => value === predicate; @@ -60,7 +60,7 @@ export function some( const $checker = checker as Store<(value: T) => boolean>; return combine($checker, $values, (checker, values) => values.some(checker), { - skipVoid: true, + skipVoid: false, }); }