refactor: replace until loop with map

This commit is contained in:
André Sá 2022-03-08 17:31:44 +00:00
parent 93873306a9
commit 2e3e050c54

View file

@ -46,24 +46,18 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
}) })
} }
const steps = [] const steps = R.map(
it => ({
R.until(
R.gt(R.__, machine.numberOfCassettes),
it => {
steps.push({
type: `cassette${it}`, type: `cassette${it}`,
display: `Cassette ${it}`, display: `Cassette ${it}`,
component: Autocomplete, component: Autocomplete,
inputProps: { inputProps: {
options: R.map(it => ({ code: it, display: it }))(options), options: R.map(it => ({ code: it, display: it }), options),
labelProp: 'display', labelProp: 'display',
valueProp: 'code' valueProp: 'code'
} }
}) }),
return R.add(1, it) R.range(1, machine.numberOfCassettes + 1)
},
1
) )
const schema = () => const schema = () =>