import { Book , Loan , User } from '@lib/entities' ; export type MemoryDB = { books : Set < Book > ; loans : Set < Loan > ; users : Set < User > ; } ; export function createDB ( ) { return { books : new Set ( ) , loans : new Set ( ) , users : new Set ( ) } ; } export function withDB < I , O > ( db , fn ) { return function ( input ) { return fn ( db , input ) ; } ; }