const $apply: <T>(
$apply: (t: T) => T,
) => { $apply: (t: T) => T }
Apply a function to a value.
import { $apply } from "@use-gpu/state";
const value = {
hello: {text: 'world', bar: 2},
foo: 1,
};
const update = {
hello: {text: $apply(text => text + ' !!!') },
};
expect(patch(value, update)).toEqual({
hello: {text: 'world !!!', bar: 2},
foo: 1,
});
packages / state / src / patch.ts