Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for objects #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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