Skip to content

Add support for objects#3

Open
cameronhunter wants to merge 5 commits intoizaakschroeder:masterfrom
cameronhunter:object-support
Open

Add support for objects#3
cameronhunter wants to merge 5 commits intoizaakschroeder:masterfrom
cameronhunter:object-support

Conversation

@cameronhunter
Copy link

Hi,

Your package is my "go to" for computing the cartesian product of array values. Over the last few months I've found a repeated use-case for computing the cartesian product but with names rather than relying on array order. For example:

const elements = {
  color: ['black', 'white'],
  pattern: ['spots', 'stripes']
};

for (const { color, pattern } of product(elements)) {
  console.log(`The color is ${color} and the pattern is ${pattern}`);
}

I've mostly just been copying and pasting the code that computes this around, but since it uses cartesian-product I thought that perhaps it should just be a feature.

I had to update a few dependencies in the repository to get the linting and testing working, I tried to make as few changes as possible so as not to overwhelm the PR.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant