I'm writing a minifier for lexical nodes. Writing unit tests and after taking a quick look at the options for generating test data (factory-girl
, faker.js
, casual.js
, etc) I saw that there wasn't one that would allow me to quickly define different values per property and generate a list of objects that use those values.
I am sharing a small utility to generate a list of objects from a shape, that iterates through the different possibilities for each property.
type Shape<T> = {
[key in keyof T]: any;
};