Skip to content

Commit

Permalink
Use skipVoid false
Browse files Browse the repository at this point in the history
  • Loading branch information
zerobias committed Nov 10, 2023
1 parent 46a87a3 commit 68b3f8d
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/and/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export function and(...stores: Array<Store<any>>): Store<boolean> {
}
return true;
},
{ skipVoid: true },
{ skipVoid: false },
) as Store<boolean>;
}
2 changes: 1 addition & 1 deletion src/combine-events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function combineEvents<P>({

sample({
source: eventsTrriggered,
filter: $counter.map((value) => value === 0, { skipVoid: true }),
filter: $counter.map((value) => value === 0, { skipVoid: false }),
target: target as UnitTargetable<any>,
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/condition/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function inverse<A extends boolean, T>(
fnOrUnit: Store<boolean> | ((payload: T) => boolean),
): Store<boolean> | ((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);
}
2 changes: 1 addition & 1 deletion src/either/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function either<Then, Other>(
then as Store<Then>,
other as Store<Other>,
(filter, then, other) => (filter ? then : other),
{ skipVoid: true },
{ skipVoid: false },
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/empty/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Store } from 'effector';

export function empty<A>(source: Store<A | null | undefined>): Store<boolean> {
return source.map((value) => value == null, { skipVoid: true });
return source.map((value) => value == null, { skipVoid: false });
}
4 changes: 3 additions & 1 deletion src/equals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ export function equals<A, B>(
? B
: { error: 'argument b should extends a' },
): Store<boolean> {
return combine(a as Store<A>, b as Store<A>, (a, b) => a === b, { skipVoid: true });
return combine(a as Store<A>, b as Store<A>, (a, b) => a === b, {
skipVoid: false,
});
}
4 changes: 2 additions & 2 deletions src/every/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function every<T>(
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;
Expand All @@ -63,7 +63,7 @@ export function every<T>(
const $checker = checker as Store<(value: T) => boolean>;

return combine($checker, $values, (checker, values) => values.every(checker), {
skipVoid: true,
skipVoid: false,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/format/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function format<Values extends StoreOrValue<any>[]>(
),
'',
),
{ skipVoid: true },
{ skipVoid: false },
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/in-flight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
);
}
2 changes: 1 addition & 1 deletion src/interval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function interval<S extends unknown, F extends unknown>({
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;
Expand Down
2 changes: 1 addition & 1 deletion src/not/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Store } from 'effector';

export function not<T extends unknown>(source: Store<T>): Store<boolean> {
return source.map((value) => !value, { skipVoid: true });
return source.map((value) => !value, { skipVoid: false });
}
2 changes: 1 addition & 1 deletion src/or/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export function or(...stores: Array<Store<any>>): Store<boolean> {
}
return false;
},
{ skipVoid: true },
{ skipVoid: false },
) as Store<boolean>;
}
2 changes: 1 addition & 1 deletion src/pending/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export function pending({
return combine(
effects.map((fx) => fx.pending),
strategy,
{ skipVoid: true },
{ skipVoid: false },
);
}
2 changes: 1 addition & 1 deletion src/reshape/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function reshape<Type, Shape extends Record<string, unknown>>({
const result = fn(state);
return result === undefined ? null : result;
},
{ skipVoid: true },
{ skipVoid: false },
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/some/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function some<T>(
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;
Expand All @@ -60,7 +60,7 @@ export function some<T>(
const $checker = checker as Store<(value: T) => boolean>;

return combine($checker, $values, (checker, values) => values.some(checker), {
skipVoid: true,
skipVoid: false,
});
}

Expand Down

0 comments on commit 68b3f8d

Please sign in to comment.