Create a collection from a generator function
Closed this issue · 0 comments
add a new generators to generate collection from a generator function
Generate a collection from a custom generators functions
@category util
toCollection(() => {
return { data: randNumber(); }
})
toCollection(() => {
return { data: randNumber(); }
}, { length: 10 }) // default is no length.
It is a wrapper for the internal fake function.
Discussed in #233
Originally posted by jongbonga March 23, 2022
I want to create a collection of custom objects
e.g: const customObject = {this: randBoolean(), that: randShape(), ...}
hand have and array of [customObject, ...]
.
Do I need to handle it myself with a loop or there is something randCollection({collection: customObject, length: 5})
already (I've gone through the doc and couldn't find such)?.