{"name":"fast-cartesian","version":"8.0.0","type":"module","exports":{"types":"./build/src/main.d.ts","default":"./build/src/main.js"},"main":"./build/src/main.js","types":"./build/src/main.d.ts","sideEffects":false,"scripts":{"test":"gulp test"},"description":"Fast cartesian product","keywords":["cartesian","cartesian-product","performance","sets","functional-programming","functional","product","iterable","algorithm","data-structures","es6","javascript","typescript","library","nodejs","lodash","lodash-fp","cartesian-products","combinatorics","combinations"],"license":"Apache-2.0","homepage":"https://www.github.com/ehmicky/fast-cartesian","repository":{"type":"git","url":"git+https://github.com/ehmicky/fast-cartesian.git"},"bugs":{"url":"https://github.com/ehmicky/fast-cartesian/issues"},"author":{"name":"ehmicky","email":"ehmicky@gmail.com","url":"https://github.com/ehmicky"},"directories":{"lib":"src"},"devDependencies":{"@ehmicky/dev-tasks":"^2.0.80","big-cartesian":"^5.0.0","cartesian":"^1.0.1","cartesian-product":"^2.1.2","cxproduct":"^2.1.3","fast-cartesian-product":"^2.0.1","lodash":"^4.17.20","lodash.product":"^18.10.0","power-cartesian-product":"^0.0.6","spyd":"^0.6.1","test-each":"^5.7.1"},"engines":{"node":">=16.17.0"},"gitHead":"7ac4fb5d6b191a752ef3757464a3172cff1d477c","_id":"fast-cartesian@8.0.0","_nodeVersion":"20.1.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-kEt+ALPOvytBhoneZCjHSkjwkkujAmK4x2+Zv8hNVhD7KQgbaZ4xBwDNSIcYlxhvYLFl+/NBf1bO2MecjOOzEw==","shasum":"ba5fb12b58b58f401792b6db2d376ff892dacefe","tarball":"http://registry-npm.ywwl.com/fast-cartesian/download/fast-cartesian-8.0.0.tgz","fileCount":7,"unpackedSize":23804,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD40CQiN6OwrHuGWzEPmoGTgU2D+GCD0cjJBt/ufEFJjgIgfK6d0dctJi4X3Xu4Kz4J2Qkf4tAMUsmZn77a28FpK6U="}],"size":8234,"noattachment":false,"key":"/fast-cartesian/-/fast-cartesian-8.0.0.tgz"},"_npmUser":{"name":"ehmicky","email":"ehmicky@gmail.com"},"maintainers":[{"name":"ehmicky","email":"ehmicky@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fast-cartesian_8.0.0_1684019865563_0.29330732355415856"},"_hasShrinkwrap":false,"readme":"[![Node](https://img.shields.io/badge/-Node.js-808080?logo=node.js&colorA=404040&logoColor=66cc33)](https://www.npmjs.com/package/fast-cartesian)\n[![Browsers](https://img.shields.io/badge/-Browsers-808080?logo=firefox&colorA=404040)](https://unpkg.com/fast-cartesian?module)\n[![TypeScript](https://img.shields.io/badge/-Typed-808080?logo=typescript&colorA=404040&logoColor=0096ff)](/src/main.ts)\n[![Codecov](https://img.shields.io/badge/-Tested%20100%25-808080?logo=codecov&colorA=404040)](https://codecov.io/gh/ehmicky/fast-cartesian)\n[![Minified size](https://img.shields.io/bundlephobia/minzip/fast-cartesian?label&colorA=404040&colorB=808080&logo=webpack)](https://bundlephobia.com/package/fast-cartesian)\n[![Mastodon](https://img.shields.io/badge/-Mastodon-808080.svg?logo=mastodon&colorA=404040&logoColor=9590F9)](https://fosstodon.org/@ehmicky)\n[![Medium](https://img.shields.io/badge/-Medium-808080.svg?logo=medium&colorA=404040)](https://medium.com/@ehmicky)\n\nFast cartesian product.\n\nRetrieves every possible combination between several arrays\n([cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)).\n\n[Fastest](#benchmarks) available library in JavaScript.\n\nWhen producing millions of combinations or combining hundreds of arrays,\n[`big-cartesian`](https://github.com/ehmicky/big-cartesian) should be used\ninstead.\n\n# Hire me\n\nPlease\n[reach out](https://www.linkedin.com/feed/update/urn:li:activity:7117265228068716545/)\nif you're looking for a Node.js API or CLI engineer (11 years of experience).\nMost recently I have been [Netlify Build](https://github.com/netlify/build)'s\nand [Netlify Plugins](https://www.netlify.com/products/build/plugins/)'\ntechnical lead for 2.5 years. I am available for full-time remote positions.\n\n# Testimonials\n\n> We are now using this library for ourworldindata.org and have seen an almost\n> 50-fold performance increase from the naive method we used before!\n>\n> @MarcelGerber\n\n# Example\n\n```js\nimport fastCartesian from 'fast-cartesian'\n\nconsole.log(\n  fastCartesian([\n    ['red', 'blue'],\n    ['circle', 'square'],\n  ]),\n)\n// [\n//   [ 'red', 'circle' ],\n//   [ 'red', 'square' ],\n//   [ 'blue', 'circle' ],\n//   [ 'blue', 'square' ]\n// ]\n\n// Return initial indexes\nconsole.log(\n  fastCartesian(\n    [\n      ['red', 'blue'],\n      ['circle', 'square'],\n    ].map(Object.entries),\n  ),\n)\n// [\n//   [ [ '0', 'red' ], [ '0', 'circle' ] ],\n//   [ [ '0', 'red' ], [ '1', 'square' ] ],\n//   [ [ '1', 'blue' ], [ '0', 'circle' ] ],\n//   [ [ '1', 'blue' ], [ '1', 'square' ] ]\n// ]\n```\n\n# Demo\n\nYou can try this library:\n\n- either directly [in your browser](https://repl.it/@ehmicky/fast-cartesian).\n- or by executing the [`examples` files](examples/README.md) in a terminal.\n\n# Install\n\n```\nnpm install fast-cartesian\n```\n\nThis package works in both Node.js >=18.18.0 and\n[browsers](https://raw.githubusercontent.com/ehmicky/dev-tasks/main/src/browserslist).\n\nThis is an ES module. It must be loaded using\n[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c),\nnot `require()`. If TypeScript is used, it must be configured to\n[output ES modules](https://www.typescriptlang.org/docs/handbook/esm-node.html),\nnot CommonJS.\n\n# API\n\n## fastCartesian(inputs)\n\n`inputs`: `Array<Array>`\\\n_Return value_: `Array<Array>`\n\nReturns a two-dimensional `Array` where each row is a combination of `inputs`.\n\n# Benchmarks\n\nThe following [benchmarks](benchmark/tasks.js) compare the performance of this\nlibrary against alternatives\n([`big-cartesian`](https://github.com/ehmicky/big-cartesian),\n[`cx-product`](https://github.com/anywhichway/cxproduct),\n[`cartesian-product`](https://github.com/izaakschroeder/cartesian-product),\n[`fast-cartesian-product`](https://github.com/fisker/fast-cartesian-product),\n[`power-cartesian-product`](https://github.com/fisker/power-cartesian-product),\n[`cartesian`](https://github.com/alexindigo/cartesian) and\n[`lodash.product`](https://github.com/SeregPie/lodash.product)).\n\n```\n## fast-cartesian ######################\n1 array                           1.22ms\n2 arrays                          1.82ms\n4 arrays                          3.12ms\n8 arrays                          1.87ms\n16 arrays                         4.82ms\n\n## cxproduct ###########################\n1 array                           1.91ms\n2 arrays                          3.47ms\n4 arrays                          3.62ms\n8 arrays                          2.39ms\n16 arrays                         5.05ms\n\n## cartesian-product ###################\n1 array                           4.61ms\n2 arrays                          2.92ms\n4 arrays                         11.80ms\n8 arrays                         14.78ms\n16 arrays                        21.00ms\n\n## big-cartesian #######################\n1 array                           7.21ms\n2 arrays                          6.68ms\n4 arrays                          8.53ms\n8 arrays                          7.80ms\n16 arrays                        18.30ms\n\n## power-cartesian-product #############\n1 array                           6.84ms\n2 arrays                          8.54ms\n4 arrays                         12.35ms\n8 arrays                         11.78ms\n16 arrays                        18.98ms\n\n## cartesian ###########################\n1 array                           3.44ms\n2 arrays                         11.12ms\n4 arrays                         13.27ms\n8 arrays                         16.11ms\n16 arrays                        22.90ms\n\n## fast-cartesian-product ##############\n1 array                          23.04ms\n2 arrays                         24.11ms\n4 arrays                         30.46ms\n8 arrays                         45.65ms\n16 arrays                        65.12ms\n\n## lodash.product ######################\n1 array                          36.51ms\n2 arrays                         37.89ms\n4 arrays                         41.71ms\n8 arrays                         52.72ms\n16 arrays                        80.84ms\n```\n\n# Support\n\nFor any question, _don't hesitate_ to [submit an issue on GitHub](../../issues).\n\nEveryone is welcome regardless of personal background. We enforce a\n[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and\ninclusive environment.\n\n# Contributing\n\nThis project was made with ❤️. The simplest way to give back is by starring and\nsharing it online.\n\nIf the documentation is unclear or has a typo, please click on the page's `Edit`\nbutton (pencil icon) and suggest a correction.\n\nIf you would like to help us fix a bug or add a new feature, please check our\n[guidelines](CONTRIBUTING.md). Pull requests are welcome!\n\n<!-- Thanks go to our wonderful contributors: -->\n\n<!-- ALL-CONTRIBUTORS-LIST:START -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"https://fosstodon.org/@ehmicky\"><img src=\"https://avatars2.githubusercontent.com/u/8136211?v=4?s=100\" width=\"100px;\" alt=\"\"/><br /><sub><b>ehmicky</b></sub></a><br /><a href=\"https://github.com/ehmicky/fast-cartesian/commits?author=ehmicky\" title=\"Code\">💻</a> <a href=\"#design-ehmicky\" title=\"Design\">🎨</a> <a href=\"#ideas-ehmicky\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"https://github.com/ehmicky/fast-cartesian/commits?author=ehmicky\" title=\"Documentation\">📖</a></td>\n    <td align=\"center\"><a href=\"https://marcelgerber.de\"><img src=\"https://avatars0.githubusercontent.com/u/2641501?v=4?s=100\" width=\"100px;\" alt=\"\"/><br /><sub><b>Marcel Gerber</b></sub></a><br /><a href=\"https://github.com/ehmicky/fast-cartesian/commits?author=MarcelGerber\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/Paulomart\"><img src=\"https://avatars.githubusercontent.com/u/4148404?v=4?s=100\" width=\"100px;\" alt=\"\"/><br /><sub><b>Paul Heidenreich</b></sub></a><br /><a href=\"https://github.com/ehmicky/fast-cartesian/commits?author=Paulomart\" title=\"Code\">💻</a></td>\n  </tr>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n","publish_time":1684019865708,"_cnpm_publish_time":1684019865708,"dist-tags":{"latest":"9.0.1"}}