effect@3.4.0
Minor Changes
-
#2938
c0ce180Thanks @LaureRC! - Make Option.liftPredicate dual -
#2938
61707b6Thanks @LaureRC! - Add Effect.liftPredicateEffect.liftPredicatetransforms aPredicatefunction into anEffectreturning the input value if the predicate returnstrueor failing with specified error if the predicate fails.import { Effect } from "effect"; const isPositive = (n: number): boolean => n > 0; // succeeds with `1` Effect.liftPredicate(1, isPositive, (n) => `${n} is not positive`); // fails with `"0 is not positive"` Effect.liftPredicate(0, isPositive, (n) => `${n} is not positive`);
-
#2938
9c1b5b3Thanks @tim-smart! - add EventListener type to Stream to avoid use of dom lib -
#2938
a35faf8Thanks @gcanti! - AddlastNonEmptyfunction toChunkmodule, closes #2946 -
#2938
ff73c0cThanks @dilame! - feat(Stream): implement Success, Error, Context type accessors -
#2938
984d516Thanks @tim-smart! - add Micro moduleA lightweight alternative to Effect, for when bundle size really matters.
At a minimum, Micro adds 5kb gzipped to your bundle, and scales with the amount
of features you use. -
#2938
8c3b8a2Thanks @gcanti! - addManagedRuntimetype utils (Context, andError) -
#2938
91bf8a2Thanks @msensys! - AddTuple.atapi, to retrieve an element at a specified index from a tuple.import { Tuple } from "effect"; assert.deepStrictEqual(Tuple.at([1, "hello", true], 1), "hello");
-
#2938
c6a4a26Thanks @datner! - addensureutil for Array, used to normalizeA | ReadonlyArray<A>import { ensure } from "effect/Array"; // lets say you are not 100% sure if it's a member or a collection declare const someValue: { foo: string } | Array<{ foo: string }>; // $ExpectType ({ foo: string })[] const normalized = ensure(someValue);