UNPKG

infra-cli

Version:
20 lines (13 loc) 400 B
import path from 'path' import requireContext from 'require-context' import delay from 'mocker-api/lib/delay' const importAll = r => { let cache = {} r.keys().forEach(key => { const currentObj = r(key).default cache = { ...cache, ...currentObj } }) return cache } const obj = importAll(requireContext(path.resolve('./mock/data'), true, /\.js$/)) export default delay(obj, 1000)