refactor: replace until loop with map
This commit is contained in:
parent
93873306a9
commit
2e3e050c54
1 changed files with 12 additions and 18 deletions
|
|
@ -46,24 +46,18 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
|
|||
})
|
||||
}
|
||||
|
||||
const steps = []
|
||||
|
||||
R.until(
|
||||
R.gt(R.__, machine.numberOfCassettes),
|
||||
it => {
|
||||
steps.push({
|
||||
type: `cassette${it}`,
|
||||
display: `Cassette ${it}`,
|
||||
component: Autocomplete,
|
||||
inputProps: {
|
||||
options: R.map(it => ({ code: it, display: it }))(options),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
}
|
||||
})
|
||||
return R.add(1, it)
|
||||
},
|
||||
1
|
||||
const steps = R.map(
|
||||
it => ({
|
||||
type: `cassette${it}`,
|
||||
display: `Cassette ${it}`,
|
||||
component: Autocomplete,
|
||||
inputProps: {
|
||||
options: R.map(it => ({ code: it, display: it }), options),
|
||||
labelProp: 'display',
|
||||
valueProp: 'code'
|
||||
}
|
||||
}),
|
||||
R.range(1, machine.numberOfCassettes + 1)
|
||||
)
|
||||
|
||||
const schema = () =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue