UNPKG

@practicaloptimism/uniplexer

Version:

A multiplexer for 3rd party service providers and application protocols

25 lines (17 loc) 523 B
import { CreateItem } from '../../../@utility/data-structures/database' import { createItemStore } from './create-item-store' import { storeTable } from '../variables' const createItem: CreateItem = method async function method (storeId: string, item: any, itemId?: string): Promise<any[]> { if (!storeTable[storeId]) { await createItemStore(storeId) } if (!itemId) { itemId = Math.random().toString() } storeTable[storeId][itemId] = item return Promise.resolve([item]) } export { createItem }