wrap-in-array
v1.0.1
Published
Sometimes you need pass arguments or params that could be single item or collection in to the same interface. And that integrace need to lead arguments in to collection
Downloads
1
Readme
wrap in array
Sometimes you need pass arguments or params that could be single item or collection in to the same interface. And that integrace need to lead arguments in to collection
import { wrapInArray } from 'wrap-in-array'
// args could be {} or [{}, {}]
const myFn = (_args) => {
const args = wrapInArray(_args)
args.map(() => {
// do something useful
})
}
also available method wrapInArrayOfArrays
for nested array