UNPKG

woltage

Version:

A CQRS and Event-Sourcing Framework

12 lines (11 loc) 352 B
export function createStore(config, prefix) { return new config.adapter(prefix, ...(config.args ?? [])); } export function createStoreFactory(stores) { return (storeName, prefix) => { if (!stores[storeName]) throw new Error(`Store ${storeName} not found.`); return createStore(stores[storeName], prefix); }; } ;