export function useMutations(arr) { const store = useStore() const keypair = arr.map(m => [m, input => store.commit(m, input)]) return Object.fromEntries(keypair) } code example
Example: javascript convert Object.entries back to object
const arr = [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ];
const obj = Object.fromEntries(arr);
console.log(obj); // { 0: "a", 1: "b", 2: "c" }