Sudoo-Immutable

Immutable Medium

produce, asyncProduce, and clone function are just easier to call method, supported by Medium class.

Instantiate

import { Medium } from "@sudoo/immutable";

const medium = Medium.from(object);

Clone

const newObject = medium.clone();

Mutate

const newObject = medium.mutate((draft) => {
    draft.hello = "world";
});

Async Mutate

const newObject = await medium.asyncMutate(async (draft) => {
    draft.hello = await getWorld();
});