dollar

Creator: coderz1093

Last updated:

0 purchases

dollar Image
dollar Images

Languages

Categories

Add to Cart

Description:

dollar

dollar #

A DSL to keep state in your functions.
Inspired by React hooks.
Usage #
final func = $1((bool input) {
final a = $value(() => 1);
$fork(input);
final b = input ? $value(() => 2) : $value(() => 3);
$merge();
a.value++;
b.value--;
return [a.value, b.value];
});
expect(func(true), [2, 1]);
expect(func(true), [3, 0]);
expect(func(false), [4, 2]);
expect(func(false), [5, 1]);
expect(func(true), [6, -1]);
expect(func(false), [7, 0]);
copied to clipboard
See tests for more usages.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.