predict · generated
A model wrote this helper. Say what it returns and what it changed on the way, before you run it.
Answer before anything runs. Then the machine runs it, and you can step through what it did.
const BASE = { role: "viewer", scopes: [] };
function grant(user, scope) {
const next = { ...BASE, ...user };
next.scopes.push(scope);
return next;
}
const alice = grant({ name: "alice" }, "read");
const bob = grant({ name: "bob" }, "write");
const aliceScopes = alice.scopes.length;
const baseScopes = BASE.scopes.length;