budibase/packages/datastores/tests/helpers.js

14 lines
308 B
JavaScript
Raw Normal View History

import { map } from "lodash"
2019-06-07 15:18:10 +02:00
export const action = (name, run, iterator = iterateActionTimes(1)) => ({
name,
run,
iterator,
})
2019-06-07 15:18:10 +02:00
export const iterateActionTimes = times => run =>
map([...Array(times).keys()], run)
2019-06-07 15:18:10 +02:00
export const iterateCollection = getCollection => run =>
map(getCollection(), run)