evolve
ts
function Object.evolve<T extends object, U extends Evolver<T>>(
target: T,
evolver: U,
): TCreates a new object with multiple properties transformed by their corresponding functions in the evolver object.
Example
ts
import { Object } from "@monstermann/object";
Object.evolve(
{ a: 1, b: 2, c: 3 },
{
a: (x) => x * 2,
c: (x) => x + 1,
},
); // { a: 2, b: 2, c: 4 }ts
import { Object } from "@monstermann/object";
pipe(
{ a: 1, b: 2, c: 3 },
Object.evolve({
a: (x) => x * 2,
c: (x) => x + 1,
}),
); // { a: 2, b: 2, c: 4 }