diff --git a/README.md b/README.md index ff28101..5cc33b4 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,6 @@ Retrieves every possible combination between several arrays ([cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)): - [fastest](#benchmarks) available library in JavaScript -- works with any - [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables): - arrays, - [generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator), - strings, maps, sets, etc. # Example @@ -34,14 +29,6 @@ const fastCartesian = require('fast-cartesian') // [ '04', 'Feb', '2019' ], // ] console.log(fastCartesian(['01', '04'], ['Jan', 'Feb'], ['1980', '2019'])) - -// Works with any iterable: arrays, generators, strings, maps, sets, etc. -const generator = function*() { - yield 'Jan' - yield 'Feb' -} - -console.log(fastCartesian(['01', '04'], generator(), ['1980', '2019'])) ``` # Demo @@ -70,9 +57,7 @@ const combinations = fastCartesian(...inputs) ## fastCartesian(...inputs) -`inputs`: -[`iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables) -(one or several)
_Return value_: `array[]` +`inputs`: `Array` (one or several)
_Return value_: `array[]` Returns a two-dimensional `array` where each row is a combination of `inputs`. diff --git a/examples/README.md b/examples/README.md index 529f042..3918d2b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -11,4 +11,3 @@ They can also be run directly ## Examples - [Main usage](main.js) -- [Iterables](iterable.js) diff --git a/examples/iterable.js b/examples/iterable.js deleted file mode 100644 index d24c242..0000000 --- a/examples/iterable.js +++ /dev/null @@ -1,32 +0,0 @@ -// Demo of using iterables. -// This file can be directly run: -// - first install `fast-cartesian` -// - then `node node_modules/fast-cartesian/examples/iterable.js` -// An online demo is also available at: -// https://repl.it/@ehmicky/fast-cartesian - -'use strict' - -// Ignore the following line: this is only needed for internal purposes. -require('./utils.js') - -const fastCartesian = require('fast-cartesian') - -// Works with any iterable: arrays, generators, strings, maps, sets, etc. -const generator = function*() { - yield 'Jan' - yield 'Feb' -} - -// Prints: -// [ -// [ '01', 'Jan', '1980' ], -// [ '01', 'Jan', '2019' ], -// [ '01', 'Feb', '1980' ], -// [ '01', 'Feb', '2019' ], -// [ '04', 'Jan', '1980' ], -// [ '04', 'Jan', '2019' ], -// [ '04', 'Feb', '1980' ], -// [ '04', 'Feb', '2019' ], -// ] -console.log(fastCartesian(['01', '04'], generator(), ['1980', '2019']))