import { Item } from '../../types/Item' import { IndexDef } from '../../types/IndexDef' import { IndexStored } from '../../types/IndexStored' import Collection from '../collection' export function restore_index_def( collection: Collection, input: IndexStored, ): IndexDef { const { key, auto, unique, sparse, required, ignoreCase } = input return { key, auto, unique, sparse, required, ignoreCase, process: ignoreCase ? undefined : input.process ? eval(input.process) : undefined, gen: input.gen ? Collection.genCache[input.gen] ? Collection.genCache[input.gen] : eval(input.gen) : undefined, } }